diff --git a/GameObjectManager.cpp b/GameObjectManager.cpp index 0532fd1..ed5c4d9 100644 --- a/GameObjectManager.cpp +++ b/GameObjectManager.cpp @@ -282,14 +282,14 @@ void GameObjectManager::handleEvent(const SDL_Event& event) { } } if (isBatteryDialogActive) { - BatteryDialogIndex++; - if (BatteryDialogIndex < batteryDialogTextures.size()) { - batteryDialogTexturePtr = std::make_shared(CreateTextureDataFromBmp24(batteryDialogTextures[BatteryDialogIndex])); - } else { - isBatteryDialogActive = false; - } + BatteryDialogIndex++; + if (BatteryDialogIndex <= batteryDialogTextures.size()) { + batteryDialogTexturePtr = std::make_shared(CreateTextureDataFromBmp24(batteryDialogTextures[BatteryDialogIndex])); + } else { + isBatteryDialogActive = false; } } + } else if (event.type == SDL_MOUSEBUTTONDOWN) { const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true); diff --git a/GameObjectManager.h b/GameObjectManager.h index 98cb22e..f88b869 100644 --- a/GameObjectManager.h +++ b/GameObjectManager.h @@ -88,7 +88,7 @@ public: ZL::VertexRenderStruct monsterScreenMeshMutable; std::vector dialogTextures = { // Список диалогов - "./start_dialog.bmp", + "./photo.bmp", "./next_dialog.bmp", "./final_dialog.bmp", }; diff --git a/RenderSystem.cpp b/RenderSystem.cpp index 5a55ed4..59690c1 100644 --- a/RenderSystem.cpp +++ b/RenderSystem.cpp @@ -221,6 +221,8 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) { renderer.DrawVertexRenderStruct(gameObjects.inventoryIconMeshMutable); // Используем 2D меш инвентаря renderer.PopMatrix(); } + + // Отрисовка диалогового окна батарейки if (gameObjects.isBatteryDialogActive && gameObjects.batteryDialogTexturePtr) { renderer.PushMatrix(); float xPos = Environment::width / 2.0f - 250; // Центрируем @@ -232,6 +234,7 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) { renderer.PopMatrix(); } + //for (const auto* ao : gameObjects.aoMgr.findByHighlighted(true)) { for (auto& ao : gameObjects.rooms[gameObjects.current_room_index].findByHighlighted(true)) { std::cout << ao->name << std::endl; diff --git a/photo.bmp b/photo.bmp new file mode 100644 index 0000000..30e9e68 Binary files /dev/null and b/photo.bmp differ