From 5ebc68043efc83e31e46fb37eaa1d1f5d097695d Mon Sep 17 00:00:00 2001 From: maka70vv <25.makarovv@gmail.com> Date: Mon, 3 Mar 2025 00:00:26 +0600 Subject: [PATCH] finished level 1 without timer --- GameObjectManager.cpp | 19 ++++++++++++++----- QuestScripts.cpp | 4 ++++ RenderSystem.cpp | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/GameObjectManager.cpp b/GameObjectManager.cpp index 54aa3a6..570b41c 100644 --- a/GameObjectManager.cpp +++ b/GameObjectManager.cpp @@ -222,7 +222,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { bearName += "M"; selectedCubes.push_back(*item); gInventoryMap.erase(item->name); - } + } } else if (bearName.length() >= 3 && !(bearName.compare("TOM") == 0)) { @@ -232,7 +232,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { } selectedCubes.clear(); } - + } } else { const auto highlightedObjects = aoMgr.findByHighlighted(true); @@ -249,7 +249,9 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { } // bx.Interpolate(animationCounter); // animationCounter += 2; + } } + else if (event.type == SDL_MOUSEWHEEL) { static const float zoomstep = 1.0f; if (event.wheel.y > 0) { @@ -327,10 +329,17 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { break; case SDLK_1: case SDLK_2: - { - int hot_key = (event.key.keysym.sym == SDLK_1) ? 1 : 2; + case SDLK_3: + case SDLK_4: + case SDLK_5: + case SDLK_6: + case SDLK_7: + case SDLK_8: + case SDLK_9: + { + UnselectAllItems(); - if (InventoryItem* item = GetItemByHotkey(hot_key)) { + if (InventoryItem* item = GetItemByHotkey(event.key.keysym.sym - SDLK_1 + 1)) { item->isSelected = true; } } diff --git a/QuestScripts.cpp b/QuestScripts.cpp index 665a3ed..f67a23a 100644 --- a/QuestScripts.cpp +++ b/QuestScripts.cpp @@ -2,6 +2,9 @@ #include "GameObjectManager.h" #include "Inventory.h" #include +#include +#include + namespace ZL { @@ -12,6 +15,7 @@ namespace ZL { if (gom.bearName.compare("TOM") == 0) { gInventoryMap.clear(); +// std::this_thread::sleep_for(std::chrono::seconds(1)); gom.switch_room(1); } }; diff --git a/RenderSystem.cpp b/RenderSystem.cpp index d046d14..2136935 100644 --- a/RenderSystem.cpp +++ b/RenderSystem.cpp @@ -269,7 +269,7 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) { // Смещаем по оси x: начиная с левой стороны и двигаясь вправо float xPos = gameObjects.SELECTED_CUBE_MARGIN - + i * (gameObjects.SELECTED_CUBE_ICON_SIZE + gameObjects.SELECTED_CUBE_MARGIN) + 50.0f; + + i * (gameObjects.SELECTED_CUBE_ICON_SIZE + gameObjects.SELECTED_CUBE_MARGIN) + 300.0f; // Оставляем y константным float yPos = 500.0f;