finished level 1 without timer

This commit is contained in:
maka70vv 2025-03-03 00:00:26 +06:00
parent cc38d52f6c
commit 5ebc68043e
3 changed files with 19 additions and 6 deletions

View File

@ -222,7 +222,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
bearName += "M"; bearName += "M";
selectedCubes.push_back(*item); selectedCubes.push_back(*item);
gInventoryMap.erase(item->name); gInventoryMap.erase(item->name);
}
} }
} }
else if (bearName.length() >= 3 && !(bearName.compare("TOM") == 0)) { else if (bearName.length() >= 3 && !(bearName.compare("TOM") == 0)) {
@ -232,7 +232,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
} }
selectedCubes.clear(); selectedCubes.clear();
} }
}
} }
else { else {
const auto highlightedObjects = aoMgr.findByHighlighted(true); const auto highlightedObjects = aoMgr.findByHighlighted(true);
@ -249,7 +249,9 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
} }
// bx.Interpolate(animationCounter); // bx.Interpolate(animationCounter);
// animationCounter += 2; // animationCounter += 2;
}
} }
else if (event.type == SDL_MOUSEWHEEL) { else if (event.type == SDL_MOUSEWHEEL) {
static const float zoomstep = 1.0f; static const float zoomstep = 1.0f;
if (event.wheel.y > 0) { if (event.wheel.y > 0) {
@ -327,10 +329,17 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
break; break;
case SDLK_1: case SDLK_1:
case SDLK_2: case SDLK_2:
{ case SDLK_3:
int hot_key = (event.key.keysym.sym == SDLK_1) ? 1 : 2; case SDLK_4:
case SDLK_5:
case SDLK_6:
case SDLK_7:
case SDLK_8:
case SDLK_9:
{
UnselectAllItems(); UnselectAllItems();
if (InventoryItem* item = GetItemByHotkey(hot_key)) { if (InventoryItem* item = GetItemByHotkey(event.key.keysym.sym - SDLK_1 + 1)) {
item->isSelected = true; item->isSelected = true;
} }
} }

View File

@ -2,6 +2,9 @@
#include "GameObjectManager.h" #include "GameObjectManager.h"
#include "Inventory.h" #include "Inventory.h"
#include <iostream> #include <iostream>
#include <chrono>
#include <thread>
namespace ZL namespace ZL
{ {
@ -12,6 +15,7 @@ namespace ZL
{ {
if (gom.bearName.compare("TOM") == 0) { if (gom.bearName.compare("TOM") == 0) {
gInventoryMap.clear(); gInventoryMap.clear();
// std::this_thread::sleep_for(std::chrono::seconds(1));
gom.switch_room(1); gom.switch_room(1);
} }
}; };

View File

@ -269,7 +269,7 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
// Смещаем по оси x: начиная с левой стороны и двигаясь вправо // Смещаем по оси x: начиная с левой стороны и двигаясь вправо
float xPos = gameObjects.SELECTED_CUBE_MARGIN 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 константным // Оставляем y константным
float yPos = 500.0f; float yPos = 500.0f;