Added help and about, minor improvements

This commit is contained in:
Vladislav Khorev 2026-03-10 21:16:58 +03:00
parent 18674efd8e
commit e5296a41b9
32 changed files with 1855 additions and 54 deletions

BIN
resources/button_info.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/button_info_pressed.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/button_invmouse.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/button_invmouse_pressed.png (Stored with Git LFS) Normal file

Binary file not shown.

218
resources/config/about.json Normal file
View File

@ -0,0 +1,218 @@
{
"root": {
"type": "LinearLayout",
"orientation": "vertical",
"vertical_align": "center",
"horizontal_align": "center",
"spacing": 10,
"x": 0,
"y": 0,
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "StaticImage",
"name": "titleBtn",
"width": 434,
"height": 35,
"texture": "resources/main_menu/title.png"
},
{
"type": "StaticImage",
"name": "aboutSpace1",
"width": 434,
"height": 10
},
{
"type": "FrameLayout",
"spacing": 10,
"width": 434,
"height": 460,
"children": [
{
"type": "TextView",
"name": "aboutText1",
"width": 434,
"height": 40,
"x": -300,
"y": 0,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Producer: Vladislav Khorev",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 60,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Lead Developer: Vladislav Khorev",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 120,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Game Designer: Leila Bobrova",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 180,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Developers: ",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 220,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Vladislav Kan",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 260,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Beksultan Almazbekov",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 300,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "Sergei Zotov",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 360,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "3D Artist: David \"nokken\" Im",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
},
{
"type": "TextView",
"name": "aboutText2",
"width": 434,
"height": 40,
"x": -300,
"y": 420,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"text": "UI/UX Design: Kenje Kazmatova",
"fontSize": 32,
"color": [
255,
255,
255,
1
],
"centered": false
}
]
},
{
"type": "Button",
"name": "aboutBackButton",
"width": 382,
"height": 56,
"textures": {
"normal": "resources/game_over/Secondarybutton.png",
"hover": "resources/game_over/Secondarybutton.png",
"pressed": "resources/game_over/Secondarybutton.png"
}
}
]
}
}

View File

@ -52,6 +52,17 @@
"hover": "resources/main_menu/Variant7.png",
"pressed": "resources/main_menu/Variant8.png"
}
},
{
"type": "Button",
"name": "aboutButton",
"width": 382,
"height": 56,
"textures": {
"normal": "resources/main_menu/about.png",
"hover": "resources/main_menu/about_hover.png",
"pressed": "resources/main_menu/about_pressed.png"
}
},
{
"type": "StaticImage",

View File

@ -48,13 +48,31 @@
"y": 100,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "right",
"vertical_gravity": "top",
"textures": {
"normal": "resources/fire.png",
"hover": "resources/fire.png",
"pressed": "resources/fire2.png",
"disabled": "resources/fire.png"
"normal": "resources/button_invmouse.png",
"hover": "resources/button_invmouse.png",
"pressed": "resources/button_invmouse_pressed.png",
"disabled": "resources/button_invmouse.png"
}
},
{
"type": "Button",
"name": "infoButton",
"x": 0,
"y": 250,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"textures": {
"normal": "resources/button_info.png",
"hover": "resources/button_info.png",
"pressed": "resources/button_info_pressed.png",
"disabled": "resources/button_info.png"
}
},
{

View File

@ -0,0 +1,163 @@
{
"root": {
"type": "FrameLayout",
"x": 0,
"y": 0,
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "StaticImage",
"name": "showPlayersButton_help",
"x": 0,
"y": 100,
"width": 150,
"height": 150,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"texture": "resources/button_players.png"
},
{
"type": "StaticImage",
"name": "infoButton_help",
"x": 0,
"y": 250,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"texture":"resources/button_info.png"
},
{
"type": "StaticImage",
"name": "infoButtonTopLeft_help",
"x": 0,
"y": 0,
"width": 300,
"height": 400,
"border" : 0,
"horizontal_gravity": "left",
"vertical_gravity": "top",
"texture": "resources/help_top_left.png"
},
{
"type": "StaticImage",
"name": "inverseMouseButton_help",
"x": 0,
"y": 100,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "right",
"vertical_gravity": "top",
"texture": "resources/button_invmouse.png"
},
{
"type": "StaticImage",
"name": "infoButtonTopRight_help",
"x": 0,
"y": 0,
"width": 300,
"height": 230,
"border" : 0,
"horizontal_gravity": "right",
"vertical_gravity": "top",
"texture": "resources/help_top_right.png"
},
{
"type": "StaticImage",
"name": "infoButtonBottomLeft_help",
"x": 0,
"y": 0,
"width": 300,
"height": 200,
"border" : 0,
"horizontal_gravity": "left",
"vertical_gravity": "bottom",
"texture": "resources/help_bottom_left.png"
},
{
"type": "StaticImage",
"name": "shootButton_help",
"x": 0,
"y": 0,
"width": 150,
"height": 150,
"horizontal_gravity": "right",
"vertical_gravity": "bottom",
"texture": "resources/fire.png"
},
{
"type": "StaticImage",
"name": "shootButton2_help",
"x": 0,
"y": 0,
"width": 150,
"height": 150,
"horizontal_gravity": "left",
"vertical_gravity": "bottom",
"texture": "resources/fire.png"
},
{
"type": "StaticImage",
"name": "minusButton_help",
"x": -20,
"y": 110,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "right",
"vertical_gravity": "bottom",
"texture": "resources/button_minus.png"
},
{
"type": "StaticImage",
"name": "plusButton_help",
"x": -20,
"y": 220,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "right",
"vertical_gravity": "bottom",
"texture": "resources/button_plus.png"
},
{
"type": "StaticImage",
"name": "takeButton_help",
"x": -20,
"y": 320,
"width": 150,
"height": 150,
"border" : 20,
"horizontal_gravity": "right",
"vertical_gravity": "bottom",
"texture": "resources/button_take.png"
},
{
"type": "StaticImage",
"name": "infoButtonBottomRight_help",
"x": 0,
"y": 0,
"width": 300,
"height": 450,
"border" : 0,
"horizontal_gravity": "right",
"vertical_gravity": "bottom",
"texture": "resources/help_bottom_right.png"
},
{
"type": "Button",
"name": "infoButtonUnderlying_help",
"x": 0,
"y": 0,
"width": "match_parent",
"height": "match_parent",
"border" : 0,
"textures": {
}
}
]
}
}

BIN
resources/gameover.png (Stored with Git LFS)

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
resources/help_bottom_left.png (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
resources/help_bottom_right.png (Stored with Git LFS) Normal file

Binary file not shown.

209
resources/help_top_left.pdn Normal file

File diff suppressed because one or more lines are too long

BIN
resources/help_top_left.png (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
resources/help_top_right.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/main_menu/about.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/main_menu/about_hover.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/main_menu/about_pressed.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/main_menu/lang.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/platform_base.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/shoot_hover.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/shoot_normal.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/shoot_pressed.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/sky/space_red.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/transparent.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -18,11 +18,13 @@ namespace ZL {
void MenuManager::setupMenu()
{
mainMenuRoot = loadUiFromFile("resources/config/main_menu.json", renderer, CONST_ZIP_FILE);
aboutMenuRoot = loadUiFromFile("resources/config/about.json", renderer, CONST_ZIP_FILE);
shipSelectionRoot = loadUiFromFile("resources/config/ship_selection_menu.json", renderer, CONST_ZIP_FILE);
connectingRoot = loadUiFromFile("resources/config/connecting.json", renderer, CONST_ZIP_FILE);
connectionFailedRoot= loadUiFromFile("resources/config/connection_failed.json", renderer, CONST_ZIP_FILE);
gameplayRoot = loadUiFromFile("resources/config/ui.json", renderer, CONST_ZIP_FILE);
gameOverRoot = loadUiFromFile("resources/config/game_over.json", renderer, CONST_ZIP_FILE);
helpScreenRoot = loadUiFromFile("resources/config/ui_with_help.json", renderer, CONST_ZIP_FILE);
connectionLostRoot = loadUiFromFile("resources/config/connection_lost.json", renderer, CONST_ZIP_FILE);
enterMainMenu();
@ -32,6 +34,7 @@ namespace ZL {
{
return state == GameState::Gameplay
|| state == GameState::GameOver
|| state == GameState::HelpScreen
|| state == GameState::ConnectionLost;
}
@ -51,6 +54,20 @@ namespace ZL {
uiManager.setButtonCallback("multiplayerButton", [this](const std::string&) {
enterShipSelectionMulti();
});
uiManager.setButtonCallback("aboutButton", [this](const std::string&) {
enterAboutMenu();
});
}
void MenuManager::enterAboutMenu()
{
state = GameState::AboutMenu;
uiManager.replaceRoot(aboutMenuRoot);
uiManager.setButtonCallback("aboutBackButton", [this](const std::string&) {
enterMainMenu();
});
}
// ── State: ShipSelectionSingle ───────────────────────────────────────────
@ -190,8 +207,53 @@ namespace ZL {
state = GameState::Gameplay;
uiManager.replaceRoot(gameplayRoot);
if (Environment::shipState.shipType == 1)
{
uiManager.findButton("shootButton")->state = ButtonState::Disabled;
uiManager.findButton("shootButton2")->state = ButtonState::Disabled;
}
else
{
if (Environment::shipState.velocity < 0.1)
{
uiManager.findButton("minusButton")->state = ButtonState::Disabled;
uiManager.findButton("plusButton")->state = ButtonState::Normal;
uiManager.findButton("shootButton")->state = ButtonState::Normal;
uiManager.findButton("shootButton2")->state = ButtonState::Normal;
}
else if (Environment::shipState.velocity >= 0.1 && Environment::shipState.velocity <= 200)
{
uiManager.findButton("minusButton")->state = ButtonState::Normal;
uiManager.findButton("plusButton")->state = ButtonState::Normal;
uiManager.findButton("shootButton")->state = ButtonState::Normal;
uiManager.findButton("shootButton2")->state = ButtonState::Normal;
}
else if (Environment::shipState.velocity > 200 && Environment::shipState.velocity < 400 - 0.1)
{
uiManager.findButton("minusButton")->state = ButtonState::Normal;
uiManager.findButton("plusButton")->state = ButtonState::Normal;
uiManager.findButton("shootButton")->state = ButtonState::Disabled;
uiManager.findButton("shootButton2")->state = ButtonState::Disabled;
}
else if (Environment::shipState.velocity >= 400 - 0.1)
{
uiManager.findButton("minusButton")->state = ButtonState::Normal;
uiManager.findButton("plusButton")->state = ButtonState::Disabled;
uiManager.findButton("shootButton")->state = ButtonState::Disabled;
uiManager.findButton("shootButton2")->state = ButtonState::Disabled;
}
}
if (forceSetupSpaceUICallback)
{
forceSetupSpaceUICallback();
}
if (auto btn = uiManager.findButton("takeButton")) btn->state = ButtonState::Disabled;
if (auto btn = uiManager.findButton("showPlayersButton"))
{
btn->state = ButtonState::Disabled;
}
/*
@ -244,13 +306,15 @@ namespace ZL {
if (onShowPlayersPressed) onShowPlayersPressed();
});
//inverseMouseButton
uiManager.setButtonPressCallback("inverseMouseButton", [this](const std::string&) {
inverseVertical = !inverseVertical;
std::cout << "Inverse mouse: " << (inverseVertical ? "ON" : "OFF") << std::endl;
});
uiManager.setButtonCallback("infoButton", [this](const std::string&) {
//if (onShowPlayersPressed) onShowPlayersPressed();
enterHelp();
});
/*
@ -281,6 +345,16 @@ namespace ZL {
});
}
void MenuManager::enterHelp()
{
state = GameState::HelpScreen;
uiManager.replaceRoot(helpScreenRoot);
uiManager.setButtonCallback("infoButtonUnderlying_help", [this](const std::string&) {
enterGameplay();
});
}
// ── State: ConnectionLost ─────────────────────────────────────────────────
void MenuManager::enterConnectionLost()

View File

@ -10,12 +10,14 @@ namespace ZL {
enum class GameState {
MainMenu,
AboutMenu,
ShipSelectionSingle,
ShipSelectionMulti,
Connecting,
ConnectionFailed,
Gameplay,
GameOver,
HelpScreen,
ConnectionLost
};
@ -25,11 +27,13 @@ namespace ZL {
// Pre-loaded UI roots (loaded once in setupMenu)
std::shared_ptr<UiNode> mainMenuRoot;
std::shared_ptr<UiNode> aboutMenuRoot;
std::shared_ptr<UiNode> shipSelectionRoot;
std::shared_ptr<UiNode> connectingRoot;
std::shared_ptr<UiNode> connectionFailedRoot;
std::shared_ptr<UiNode> gameplayRoot;
std::shared_ptr<UiNode> gameOverRoot;
std::shared_ptr<UiNode> helpScreenRoot;
std::shared_ptr<UiNode> connectionLostRoot;
// Stored for multiplayer retry
@ -40,12 +44,14 @@ namespace ZL {
// State transition methods
void enterMainMenu();
void enterAboutMenu();
void enterShipSelectionSingle();
void enterShipSelectionMulti();
void enterConnecting();
void enterConnectionFailed();
void enterGameplay();
void enterGameOver(int score);
void enterHelp();
void enterConnectionLost();
public:
@ -74,6 +80,8 @@ namespace ZL {
std::function<void(const std::string&, int)> onSingleplayerPressed;
std::function<void(const std::string&, int)> onMultiplayerPressed;
std::function<void()> onShowPlayersPressed;
std::function<void()> forceSetupSpaceUICallback;
};
} // namespace ZL

View File

@ -273,6 +273,8 @@ namespace ZL
Environment::zoom = DEFAULT_ZOOM;
Environment::tapDownHold = false;
playerScore = 0;
mainThreadHandler.EnqueueMainThreadTask([this]() {
if (menuManager.uiManager.findButton("minusButton"))
{
menuManager.uiManager.findButton("minusButton")->state = ButtonState::Disabled;
@ -292,11 +294,29 @@ namespace ZL
menuManager.uiManager.findButton("shootButton2")->state = ButtonState::Normal;
}
}
});
}
void Space::setup() {
void Space::updateShowPlayersButtonState()
{
bool hasAlivePlayers = false;
for (auto const& [id, _] : remotePlayerStates) {
if (!deadRemotePlayers.count(id)) {
hasAlivePlayers = true;
break;
}
}
if (hasAlivePlayers == showPlayersButtonEnabled) return;
showPlayersButtonEnabled = hasAlivePlayers;
auto btn = menuManager.uiManager.findButton("showPlayersButton");
if (!btn) return;
btn->state = hasAlivePlayers ? ButtonState::Normal : ButtonState::Disabled;
}
void Space::setup() {
menuManager.onRestartPressed = [this]() {
resetPlayerState();
@ -359,6 +379,12 @@ namespace ZL
}
};
menuManager.forceSetupSpaceUICallback = [this]() {
this->nearPickupBox = false;
this->showPlayersButtonEnabled = false;
};
bool cfgLoaded = sparkEmitter.loadFromJsonFile("resources/config/spark_config.json", renderer, CONST_ZIP_FILE);
bool cfgLoaded2 = sparkEmitterCargo.loadFromJsonFile("resources/config/spark_config_cargo.json", renderer, CONST_ZIP_FILE);
sparkEmitter.setIsActive(false);
@ -1695,6 +1721,7 @@ namespace ZL
remotePlayerStates[id] = playerState;
}
updateShowPlayersButtonState();
updateSparkEmitters(static_cast<float>(delta));
for (auto& p : projectiles) {
@ -2017,6 +2044,7 @@ namespace ZL
}
rebuildPlayerListIfVisible();
updateShowPlayersButtonState();
auto boxDestructions = networkClient->getPendingBoxDestructions();
if (!boxDestructions.empty()) {
std::cout << "Game: Received " << boxDestructions.size() << " box destruction events" << std::endl;

View File

@ -149,6 +149,8 @@ namespace ZL {
void resetPlayerState();
void clearTextRendererCache();
void updateShowPlayersButtonState();
bool showPlayersButtonEnabled = false;
// Player list overlay
void buildAndShowPlayerList();

View File

@ -98,12 +98,12 @@ namespace ZL {
stoneToBake = planetStones.inflateOne(0, 0.75);
/*
campPlatform.data = LoadFromTextFile02("resources/platform1.txt", CONST_ZIP_FILE);
campPlatform.RefreshVBO();
campPlatformTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/platform_base.png", CONST_ZIP_FILE));
*/
}