Merge branch 'salmon' of github.com:mephi1984/ZeptoLabTest1 into salmon

This commit is contained in:
Альберт Гадиев 2025-03-03 07:33:34 +06:00
commit df9615e42a
6 changed files with 31 additions and 2 deletions

View File

@ -337,6 +337,14 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
isDialogActive = false;
}
}
if (isBatteryDialogActive) {
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);
@ -378,12 +386,13 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
if (InventoryItem* item = GetItemSelected(true)){
std::cout << item->name << std::endl;
if (item->name == "carToy") {
std::cout << item->name << std::endl;
// Проверить, наведена ли мышь на лампу
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
std::cout << highlightedObjects.size() << std::endl;
for (auto* ao : highlightedObjects) {
if (ao && ao->name == "lampe") {
isBatteryDialogActive = true;
// Create a new lamp object with updated texture
ActiveObject updatedLamp = *ao;
// Change from dark to lit texture

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",
};
@ -96,6 +96,13 @@ public:
std::shared_ptr<Texture> dialogTexturePtr; // Активная текстура диалога
bool isDialogActive = false; // Флаг активности диалога
std::vector<std::string> batteryDialogTextures = { // Список диалогов
"./battery_dialog.bmp",
};
int BatteryDialogIndex = 0; // Текущий индекс диалога
std::shared_ptr<Texture> batteryDialogTexturePtr; // Активная текстура диалога
bool isBatteryDialogActive = false; // Флаг активности диалога
private:
//int animationCounter = 0;
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши

View File

@ -222,6 +222,19 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
renderer.PopMatrix();
}
// Отрисовка диалогового окна батарейки
if (gameObjects.isBatteryDialogActive && gameObjects.batteryDialogTexturePtr) {
renderer.PushMatrix();
float xPos = Environment::width / 2.0f - 250; // Центрируем
float yPos = Environment::height / 2.0f - 125; // Центрируем
renderer.TranslateMatrix(Vector3f{xPos, yPos, 0.0f});
renderer.ScaleMatrix(Vector3f{10.5f, 10.5f, 1.0f}); // Увеличиваем размер
glBindTexture(GL_TEXTURE_2D, gameObjects.batteryDialogTexturePtr->getTexID());
renderer.DrawVertexRenderStruct(gameObjects.inventoryIconMeshMutable); // Используем 2D меш инвентаря
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
battery_dialog.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

BIN
photo.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 MiB

After

Width:  |  Height:  |  Size: 6.3 MiB