commit
7c9e75b629
@ -305,6 +305,14 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
|||||||
isDialogActive = false;
|
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) {
|
else if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||||
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
||||||
@ -346,12 +354,13 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
|||||||
if (InventoryItem* item = GetItemSelected(true)){
|
if (InventoryItem* item = GetItemSelected(true)){
|
||||||
std::cout << item->name << std::endl;
|
std::cout << item->name << std::endl;
|
||||||
if (item->name == "carToy") {
|
if (item->name == "carToy") {
|
||||||
std::cout << item->name << std::endl;
|
|
||||||
// Проверить, наведена ли мышь на лампу
|
// Проверить, наведена ли мышь на лампу
|
||||||
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
const auto highlightedObjects = rooms[current_room_index].findByHighlighted(true);
|
||||||
std::cout << highlightedObjects.size() << std::endl;
|
std::cout << highlightedObjects.size() << std::endl;
|
||||||
for (auto* ao : highlightedObjects) {
|
for (auto* ao : highlightedObjects) {
|
||||||
if (ao && ao->name == "lampe") {
|
if (ao && ao->name == "lampe") {
|
||||||
|
isBatteryDialogActive = true;
|
||||||
// Create a new lamp object with updated texture
|
// Create a new lamp object with updated texture
|
||||||
ActiveObject updatedLamp = *ao;
|
ActiveObject updatedLamp = *ao;
|
||||||
// Change from dark to lit texture
|
// Change from dark to lit texture
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public:
|
|||||||
ZL::VertexRenderStruct monsterScreenMeshMutable;
|
ZL::VertexRenderStruct monsterScreenMeshMutable;
|
||||||
|
|
||||||
std::vector<std::string> dialogTextures = { // Список диалогов
|
std::vector<std::string> dialogTextures = { // Список диалогов
|
||||||
"./start_dialog.bmp",
|
"./photo.bmp",
|
||||||
"./next_dialog.bmp",
|
"./next_dialog.bmp",
|
||||||
"./final_dialog.bmp",
|
"./final_dialog.bmp",
|
||||||
};
|
};
|
||||||
@ -96,6 +96,13 @@ public:
|
|||||||
std::shared_ptr<Texture> dialogTexturePtr; // Активная текстура диалога
|
std::shared_ptr<Texture> dialogTexturePtr; // Активная текстура диалога
|
||||||
bool isDialogActive = false; // Флаг активности диалога
|
bool isDialogActive = false; // Флаг активности диалога
|
||||||
|
|
||||||
|
std::vector<std::string> batteryDialogTextures = { // Список диалогов
|
||||||
|
"./battery_dialog.bmp",
|
||||||
|
};
|
||||||
|
int BatteryDialogIndex = 0; // Текущий индекс диалога
|
||||||
|
std::shared_ptr<Texture> batteryDialogTexturePtr; // Активная текстура диалога
|
||||||
|
bool isBatteryDialogActive = false; // Флаг активности диалога
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//int animationCounter = 0;
|
//int animationCounter = 0;
|
||||||
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши
|
int lastMouseX = 0; // Добавляем переменные для хранения позиции мыши
|
||||||
|
|||||||
@ -222,6 +222,19 @@ void RenderSystem::drawUI(const GameObjectManager& gameObjects) {
|
|||||||
renderer.PopMatrix();
|
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 (const auto* ao : gameObjects.aoMgr.findByHighlighted(true)) {
|
||||||
for (auto& ao : gameObjects.rooms[gameObjects.current_room_index].findByHighlighted(true)) {
|
for (auto& ao : gameObjects.rooms[gameObjects.current_room_index].findByHighlighted(true)) {
|
||||||
std::cout << ao->name << std::endl;
|
std::cout << ao->name << std::endl;
|
||||||
|
|||||||
BIN
battery_dialog.bmp
Normal file
BIN
battery_dialog.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 MiB |
BIN
start_dialog.bmp
BIN
start_dialog.bmp
Binary file not shown.
|
Before Width: | Height: | Size: 4.7 MiB After Width: | Height: | Size: 6.3 MiB |
Loading…
Reference in New Issue
Block a user