From ebf292d993ffdec84f79ae36b98b0d45cb263032 Mon Sep 17 00:00:00 2001 From: maka70vv <25.makarovv@gmail.com> Date: Sun, 2 Mar 2025 21:55:27 +0600 Subject: [PATCH] started first level logic --- GameObjectManager.cpp | 21 ++++++++++++++++++++- GameObjectManager.h | 6 +++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/GameObjectManager.cpp b/GameObjectManager.cpp index 1c8879a..68dbf3a 100644 --- a/GameObjectManager.cpp +++ b/GameObjectManager.cpp @@ -11,7 +11,7 @@ const float GameObjectManager::INVENTORY_ICON_SIZE = 44.0f; const float GameObjectManager::INVENTORY_MARGIN = 20.0f; void GameObjectManager::initialize() { - + bearName = ""; current_room_index = 0; objects_in_inventory = 0; @@ -159,6 +159,25 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { } else if (event.type == SDL_MOUSEBUTTONDOWN) { if (InventoryItem* item = GetItemSelected(true)) { + if (InventoryItem* item = GetItemSelected(true)) { + if (current_room_index==1) { + if (bearName.length() < 3) { + if (item->name == "cube_T"){ + bearName += "T"; + selectedCubes.push_back(*item); + std::cout << bearName << std::endl; + } + else if (item->name == "cube_O"){ + bearName += "O"; + selectedCubes.push_back(*item); + } + else if (item->name == "cube_M"){ + bearName += "M"; + selectedCubes.push_back(*item); + } + } + } + } } else { diff --git a/GameObjectManager.h b/GameObjectManager.h index 8d2de46..1d6ca25 100644 --- a/GameObjectManager.h +++ b/GameObjectManager.h @@ -6,6 +6,7 @@ #include #include "ActiveObject.h" #include "Room.h" +#include "Inventory.h" #ifdef __linux__ #include #endif @@ -52,7 +53,10 @@ public: std::vector activeObjects; std::vector rooms; - + std::vector selectedCubes; + + std::string bearName; + AudioPlayerAsync audioPlayerAsync; ZL::VertexDataStruct inventoryIconMesh;