Skip to content

Commit

Permalink
feat(): link win scene
Browse files Browse the repository at this point in the history
  • Loading branch information
DiaboloAB committed Jun 23, 2024
1 parent fc8ee5e commit 85e495e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gui/src/render/scenes/world/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,16 @@ void World::lookTrantorian(int index)
);
_offset += offset;
}

void World::checkWinner()
{
try {
std::optional<std::string> winner = _core->_data.getWinner();
if (winner.has_value()) {
_core->_winner = winner.value();
_core->_upperState = GameState::WIN;
}
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
}
}
1 change: 1 addition & 0 deletions src/gui/src/render/scenes/world/World.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class World : public IScene {
void initSounds();
bool drawBuilding(sf::RenderWindow &window, int i, int j);
bool drawTrantorian(sf::RenderWindow &window, int i, int j);
void checkWinner();
};


Expand Down

0 comments on commit 85e495e

Please sign in to comment.