Some clean up

This commit is contained in:
Vladislav Khorev 2026-05-02 20:40:29 +03:00
parent 6149182f02
commit fb7b42ddf9
20 changed files with 122 additions and 984110 deletions

View File

@ -0,0 +1,46 @@
{
"root": {
"type": "FrameLayout",
"name": "hud_root",
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "TextButton",
"name": "inventory_button",
"x": 50.0,
"y": 50.0,
"width": 150.0,
"height": 60.0,
"text": "Inventory",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"textCentered": true,
"color": [1.0, 1.0, 1.0, 1.0],
"textures": {
"normal": "resources/w/red.png",
"hover": "resources/w/red.png",
"pressed": "resources/w/red.png"
}
},
{
"type": "TextButton",
"name": "quest_journal_button",
"x": 220.0,
"y": 50.0,
"width": 170.0,
"height": 60.0,
"text": "Quests",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"textCentered": true,
"color": [1.0, 1.0, 1.0, 1.0],
"textures": {
"normal": "resources/w/red.png",
"hover": "resources/w/red.png",
"pressed": "resources/w/red.png"
}
}
]
}
}

View File

@ -5,42 +5,6 @@
"width": "match_parent", "width": "match_parent",
"height": "match_parent", "height": "match_parent",
"children": [ "children": [
{
"type": "TextButton",
"name": "inventory_button",
"x": 50.0,
"y": 50.0,
"width": 150.0,
"height": 60.0,
"text": "Inventory",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"textCentered": true,
"color": [1.0, 1.0, 1.0, 1.0],
"textures": {
"normal": "resources/w/red.png",
"hover": "resources/w/red.png",
"pressed": "resources/w/red.png"
}
},
{
"type": "TextButton",
"name": "quest_journal_button",
"x": 220.0,
"y": 50.0,
"width": 170.0,
"height": 60.0,
"text": "Quests",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"textCentered": true,
"color": [1.0, 1.0, 1.0, 1.0],
"textures": {
"normal": "resources/w/red.png",
"hover": "resources/w/red.png",
"pressed": "resources/w/red.png"
}
},
{ {
"type": "FrameLayout", "type": "FrameLayout",
"name": "inventory_items_panel", "name": "inventory_items_panel",

File diff suppressed because it is too large Load Diff

BIN
resources/w/jam/female_packed0_diffuse.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/female_packed1_diffuse.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/female_packed2_diffuse.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/female_packed3_diffuse.png (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/woman_idle001.anim (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/woman_idle002.anim (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/woman_walk001.anim (Stored with Git LFS)

Binary file not shown.

BIN
resources/w/jam/woman_walk002.anim (Stored with Git LFS)

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,8 @@ namespace ZL {
void MenuManager::setup(Inventory& inv, const std::string& zipFile) { void MenuManager::setup(Inventory& inv, const std::string& zipFile) {
inventory = &inv; inventory = &inv;
ingameRoot = loadUiFromFile("resources/config2/ui_inventory.json", renderer, zipFile); hudRoot = loadUiFromFile("resources/config2/hud.json", renderer, zipFile);
inventoryRoot = loadUiFromFile("resources/config2/ui_inventory.json", renderer, zipFile);
questJournalRoot = loadUiFromFile("resources/config2/ui_quest_journal.json", renderer, zipFile); questJournalRoot = loadUiFromFile("resources/config2/ui_quest_journal.json", renderer, zipFile);
questJournal.loadFromFile("resources/quests/quests.json", zipFile); questJournal.loadFromFile("resources/quests/quests.json", zipFile);
@ -43,17 +44,24 @@ namespace ZL {
void MenuManager::enterGameplay() { void MenuManager::enterGameplay() {
state = GameState::Gameplay; state = GameState::Gameplay;
uiManager.replaceRoot(ingameRoot); uiManager.replaceRoot(hudRoot);
uiManager.setNodeVisible("inventory_items_panel", false);
uiManager.setNodeVisible("close_inventory_button", false);
inventoryOpen = false;
uiManager.setTextButtonCallback("inventory_button", [this](const std::string&) { uiManager.setTextButtonCallback("inventory_button", [this](const std::string&) {
std::cout << "[UI] Inventory button clicked" << std::endl; openInventory();
uiManager.setNodeVisible("inventory_items_panel", true); });
uiManager.setNodeVisible("close_inventory_button", true);
inventoryOpen = true; uiManager.setTextButtonCallback("quest_journal_button", [this](const std::string&) {
openQuestJournal();
});
}
void MenuManager::openInventory() {
state = GameState::Inventory;
uiManager.pushMenuFromSavedRoot(inventoryRoot);
uiManager.setTextButtonCallback("close_inventory_button", [this](const std::string&) {
closeInventory();
});
const auto& items = inventory->getItems(); const auto& items = inventory->getItems();
std::string itemText; std::string itemText;
@ -67,27 +75,14 @@ namespace ZL {
} }
} }
uiManager.setText("inventory_items_text", itemText); uiManager.setText("inventory_items_text", itemText);
}); }
uiManager.setTextButtonCallback("close_inventory_button", [this](const std::string&) { void MenuManager::closeInventory() {
std::cout << "[UI] Close button clicked" << std::endl; state = GameState::Gameplay;
uiManager.setNodeVisible("inventory_items_panel", false); uiManager.popMenu();
uiManager.setNodeVisible("close_inventory_button", false);
inventoryOpen = false;
});
uiManager.setTextButtonCallback("quest_journal_button", [this](const std::string&) {
openQuestJournal();
});
} }
void MenuManager::openQuestJournal() { void MenuManager::openQuestJournal() {
if (inventoryOpen) {
uiManager.setNodeVisible("inventory_items_panel", false);
uiManager.setNodeVisible("close_inventory_button", false);
inventoryOpen = false;
}
state = GameState::QuestJournal; state = GameState::QuestJournal;
uiManager.pushMenuFromSavedRoot(questJournalRoot); uiManager.pushMenuFromSavedRoot(questJournalRoot);
@ -117,10 +112,13 @@ namespace ZL {
void MenuManager::toggleQuestJournal() { void MenuManager::toggleQuestJournal() {
std::cout << "[quest] toggleQuestJournal: " << (isQuestJournalOpen() ? "closing" : "opening") << std::endl; std::cout << "[quest] toggleQuestJournal: " << (isQuestJournalOpen() ? "closing" : "opening") << std::endl;
if (isQuestJournalOpen()) { if (state == GameState::QuestJournal) {
closeQuestJournal(); closeQuestJournal();
} }
else { else {
if (state == GameState::Inventory) {
closeInventory();
}
openQuestJournal(); openQuestJournal();
} }
} }

View File

@ -15,6 +15,7 @@ namespace ZL {
enum class GameState { enum class GameState {
Gameplay, Gameplay,
Inventory,
QuestJournal QuestJournal
}; };
@ -26,9 +27,15 @@ namespace ZL {
MenuManager(Renderer& iRenderer); MenuManager(Renderer& iRenderer);
void setup(Inventory& inv, const std::string& zipFile); void setup(Inventory& inv, const std::string& zipFile);
void openInventory();
void closeInventory();
void openQuestJournal(); void openQuestJournal();
void closeQuestJournal(); void closeQuestJournal();
void toggleQuestJournal(); void toggleQuestJournal();
bool isInventoryOpen() const { return state == GameState::Inventory; }
bool isQuestJournalOpen() const { return state == GameState::QuestJournal; } bool isQuestJournalOpen() const { return state == GameState::QuestJournal; }
protected: protected:
@ -42,10 +49,10 @@ namespace ZL {
GameState state = GameState::Gameplay; GameState state = GameState::Gameplay;
Inventory* inventory = nullptr; Inventory* inventory = nullptr;
std::shared_ptr<UiNode> ingameRoot; std::shared_ptr<UiNode> hudRoot;
std::shared_ptr<UiNode> inventoryRoot;
std::shared_ptr<UiNode> questJournalRoot; std::shared_ptr<UiNode> questJournalRoot;
bool inventoryOpen = false;
int selectedQuestIndex = -1; int selectedQuestIndex = -1;
std::vector<std::string> visibleQuestIds; std::vector<std::string> visibleQuestIds;
}; };