trying to make battery dialog

This commit is contained in:
maka70vv 2025-03-03 07:22:03 +06:00
parent 112be9bb0c
commit 5e7c274645
4 changed files with 10 additions and 7 deletions

View File

@ -282,14 +282,14 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
}
}
if (isBatteryDialogActive) {
BatteryDialogIndex++;
if (BatteryDialogIndex < batteryDialogTextures.size()) {
batteryDialogTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24(batteryDialogTextures[BatteryDialogIndex]));
} else {
isBatteryDialogActive = false;
}
BatteryDialogIndex++;
if (BatteryDialogIndex <= batteryDialogTextures.size()) {
batteryDialogTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24(batteryDialogTextures[BatteryDialogIndex]));
} else {
isBatteryDialogActive = false;
}
}
}
else if (event.type == SDL_MOUSEBUTTONDOWN) {
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);

View File

@ -88,7 +88,7 @@ public:
ZL::VertexRenderStruct monsterScreenMeshMutable;
std::vector<std::string> dialogTextures = { // Список диалогов
"./start_dialog.bmp",
"./photo.bmp",
"./next_dialog.bmp",
"./final_dialog.bmp",
};

View File

@ -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;

BIN
photo.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 MiB