diff --git a/GameObjectManager.cpp b/GameObjectManager.cpp index 81e5914..9dfd612 100644 --- a/GameObjectManager.cpp +++ b/GameObjectManager.cpp @@ -7,8 +7,8 @@ namespace ZL { -const float GameObjectManager::INVENTORY_ICON_SIZE = 64.0f; -const float GameObjectManager::INVENTORY_MARGIN = 10.0f; +const float GameObjectManager::INVENTORY_ICON_SIZE = 44.0f; +const float GameObjectManager::INVENTORY_MARGIN = 20.0f; void GameObjectManager::initialize() { @@ -511,4 +511,35 @@ void GameObjectManager::worldToScreenCoordinates(Vector3f objectPos, screenY = (int)((1.0f + ndcY) * 0.5f * screenHeight); } +void GameObjectManager::addRectangle(int x, int y, int width, int height, int r, int g, int b, int borderWidth, int borderR, int borderG, int borderB) { + // Преобразование RGB в диапазон [0,1] для OpenGL + float rf = r / 255.0f; + float gf = g / 255.0f; + float bf = b / 255.0f; + float borderRf = borderR / 255.0f; + float borderGf = borderG / 255.0f; + float borderBf = borderB / 255.0f; + + // Отрисовка заполненного прямоугольника + glColor3f(rf, gf, bf); + glBegin(GL_QUADS); + glVertex2f(x, y); + glVertex2f(x + width, y); + glVertex2f(x + width, y + height); + glVertex2f(x, y + height); + glEnd(); + + // Отрисовка рамки + if (borderWidth > 0) { + glColor3f(borderRf, borderGf, borderBf); + glLineWidth(borderWidth); + glBegin(GL_LINE_LOOP); + glVertex2f(x, y); + glVertex2f(x + width, y); + glVertex2f(x + width, y + height); + glVertex2f(x, y + height); + glEnd(); + } +} + } // namespace ZL diff --git a/GameObjectManager.h b/GameObjectManager.h index cae553e..7c5eb0f 100644 --- a/GameObjectManager.h +++ b/GameObjectManager.h @@ -56,6 +56,8 @@ public: static const float INVENTORY_MARGIN; ActiveObjectManager aoMgr; int objects_in_inventory; + void addRectangle(int x, int y, int width, int height, int r, int g, int b, int borderWidth, int borderR, int borderG, int borderB); + private: //int animationCounter = 0; diff --git a/QuestScripts.cpp b/QuestScripts.cpp index 7f9a009..474cd6d 100644 --- a/QuestScripts.cpp +++ b/QuestScripts.cpp @@ -9,16 +9,12 @@ namespace ZL std::function createRoom1Logic() { return [](GameObjectManager& gom, size_t ms) -// Simple test logic { - if (GetItemByName("book")) { - std::cout << "[Room 1] Игрок поднял книгу!\n"; - gom.switch_room(1); - } }; } + std::function createRoom2Logic() { return [](GameObjectManager& gom, size_t ms) diff --git a/RenderSystem.cpp b/RenderSystem.cpp index d53e6eb..abe1ead 100644 --- a/RenderSystem.cpp +++ b/RenderSystem.cpp @@ -237,11 +237,12 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) { if (item.isSelected) { float xPos = Environment::width - gameObjects.INVENTORY_MARGIN - - gameObjects.INVENTORY_ICON_SIZE+25; + - gameObjects.INVENTORY_ICON_SIZE; float yPos = gameObjects.INVENTORY_MARGIN - + i * (gameObjects.INVENTORY_ICON_SIZE+25 + + i * (gameObjects.INVENTORY_ICON_SIZE + gameObjects.INVENTORY_MARGIN); renderer.TranslateMatrix(Vector3f{xPos, yPos, 0.0f}); + renderer.ScaleMatrix(Vector3f{1.5f, 1.5f, 1.0f}); glBindTexture(GL_TEXTURE_2D, item.texture->getTexID()); } else {