Some UI changes

This commit is contained in:
Vladislav Khorev committed 2026-03-09 13:50:59 +03:00
1 parent 24aa7007bb
commit 86a9f38c3b
15 files changed
+86 -40

No files matched your search

Binary file not shown.
Binary file not shown.
+3 -7
View File
@@ -13,7 +13,7 @@
{
"type": "StaticImage",
"name": "titleBtn",
"width": 254,
"width": 434,
"height": 35,
"texture": "resources/main_menu/title.png"
},
@@ -25,15 +25,11 @@
"texture": "resources/main_menu/line.png"
},
{
"type": "Button",
"type": "StaticImage",
"name": "subtitleBtn",
"width": 144,
"height": 11,
"textures": {
"normal": "resources/main_menu/subtitle.png",
"hover": "resources/main_menu/subtitle.png",
"pressed": "resources/main_menu/subtitle.png"
}
"texture": "resources/main_menu/subtitle.png"
},
{
"type": "Button",
@@ -10,6 +10,13 @@
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "StaticImage",
"name": "titleBtn",
"width": 266,
"height": 66,
"texture": "resources/select_your_ship.png"
},
{
"type": "LinearLayout",
"orientation": "horizontal",
+4 -2
View File
@@ -65,7 +65,8 @@
"textures": {
"normal": "resources/button_minus.png",
"hover": "resources/button_minus_pressed.png",
"pressed": "resources/button_minus_pressed.png"
"pressed": "resources/button_minus_pressed.png",
"disabled" : "resources/button_minus_disabled.png"
}
},
{
@@ -81,7 +82,8 @@
"textures": {
"normal": "resources/button_plus.png",
"hover": "resources/button_plus_pressed.png",
"pressed": "resources/button_plus_pressed.png"
"pressed": "resources/button_plus_pressed.png",
"disabled" : "resources/button_plus_disabled.png"
}
}
]
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+19 -24
View File
@@ -110,7 +110,20 @@ namespace ZL
loadingTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/loading.png", CONST_ZIP_FILE));
#endif
loadingMesh.data = CreateRect2D({ 0.5f, 0.5f }, { 0.5f, 0.5f }, 3);
float minDimension;
float width = Environment::projectionWidth;
float height = Environment::projectionHeight;
if (width >= height)
{
minDimension = height;
}
else
{
minDimension = width;
}
loadingMesh.data = CreateRect2D({ 0.0f, 0.0f }, { minDimension*0.5f, minDimension*0.5f }, 3);
loadingMesh.RefreshVBO();
#ifdef EMSCRIPTEN
@@ -268,12 +281,12 @@ namespace ZL
renderer.shaderManager.PushShader(defaultShaderName);
renderer.RenderUniform1i(textureUniformName, 0);
//float width = Environment::projectionWidth;
//float height = Environment::projectionHeight;
float width = Environment::projectionWidth;
float height = Environment::projectionHeight;
renderer.PushProjectionMatrix(
0, 1,
0, 1,
-width * 0.5f, width*0.5f,
-height * 0.5f, height * 0.5f,
-10, 10);
renderer.PushMatrix();
@@ -335,7 +348,7 @@ namespace ZL
//SDL_GL_MakeCurrent(ZL::Environment::window, glContext);
ZL::CheckGlError();
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//processTickCount();
@@ -452,24 +465,6 @@ namespace ZL
}
if (event.type == SDL_KEYUP) {
if (event.key.keysym.sym == SDLK_a) {
x = x + 0.2f;
}
if (event.key.keysym.sym == SDLK_q) {
x = x - 0.2f;
}
if (event.key.keysym.sym == SDLK_s) {
y = y + 0.2f;
}
if (event.key.keysym.sym == SDLK_w) {
y = y - 0.2f;
}
if (event.key.keysym.sym == SDLK_d) {
z = z + 0.2f;
}
if (event.key.keysym.sym == SDLK_e) {
z = z - 0.2f;
}
if (event.key.keysym.sym == SDLK_r) {
std::cout << "Camera position: x=" << x << " y=" << y << " z=" << z << std::endl;
}
+22 -1
View File
@@ -135,13 +135,16 @@ namespace ZL {
state = GameState::Gameplay;
uiManager.replaceRoot(gameplayRoot);
uiManager.findButton("minusButton")->state = ButtonState::Disabled;
auto velocityTv = uiManager.findTextView("velocityText");
if (velocityTv) {
velocityTv->rect.x = 10.0f;
velocityTv->rect.y = static_cast<float>(Environment::height) - velocityTv->rect.h - 10.0f;
}
uiManager.startAnimationOnNode("backgroundNode", "bgScroll");
//uiManager.startAnimationOnNode("backgroundNode", "bgScroll");
uiManager.setButtonPressCallback("shootButton", [this](const std::string&) {
if (onFirePressed) onFirePressed();
@@ -152,11 +155,29 @@ namespace ZL {
uiManager.setButtonPressCallback("plusButton", [this](const std::string&) {
int newVel = Environment::shipState.selectedVelocity + 1;
if (newVel > 4) newVel = 4;
uiManager.findButton("minusButton")->state = ButtonState::Normal;
if (newVel == 4)
{
uiManager.findButton("plusButton")->state = ButtonState::Disabled;
}
else
{
uiManager.findButton("plusButton")->state = ButtonState::Normal;
}
if (onVelocityChanged) onVelocityChanged(newVel);
});
uiManager.setButtonPressCallback("minusButton", [this](const std::string&) {
int newVel = Environment::shipState.selectedVelocity - 1;
if (newVel < 0) newVel = 0;
uiManager.findButton("plusButton")->state = ButtonState::Normal;
if (newVel == 0)
{
uiManager.findButton("minusButton")->state = ButtonState::Disabled;
}
else
{
uiManager.findButton("minusButton")->state = ButtonState::Normal;
}
if (onVelocityChanged) onVelocityChanged(newVel);
});
uiManager.setSliderCallback("velocitySlider", [this](const std::string&, float value) {
+7
View File
@@ -264,11 +264,17 @@ namespace ZL
explosionEmitter.setEmissionPoints(std::vector<Vector3f>());
Environment::shipState.position = Vector3f{ 0, 0, 45000.f };
Environment::shipState.velocity = 0.0f;
Environment::shipState.selectedVelocity = 0;
Environment::shipState.rotation = Eigen::Matrix3f::Identity();
Environment::inverseShipMatrix = Eigen::Matrix3f::Identity();
Environment::zoom = DEFAULT_ZOOM;
Environment::tapDownHold = false;
playerScore = 0;
if (menuManager.uiManager.findButton("minusButton"))
{
menuManager.uiManager.findButton("minusButton")->state = ButtonState::Disabled;
}
}
void Space::setup() {
@@ -1669,6 +1675,7 @@ namespace ZL
shipAlive = false;
gameOver = true;
Environment::shipState.selectedVelocity = 0;
Environment::shipState.velocity = 0.0f;
showExplosion = true;