Skip to content

Commit

Permalink
fix: game not regenerated after loading menu
Browse files Browse the repository at this point in the history
  • Loading branch information
phuwit committed Oct 24, 2023
1 parent 5599813 commit 1c529d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/Scenes/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ SceneChange Menu::run(RenderWindow &window) {
musicPtr->setVolume(10);
musicPtr->play();

dynamic_cast<Game *>(getGamePtr())->newGame();

while (window.isOpen()) {
// Update frame
Event event;
Expand All @@ -82,7 +84,6 @@ SceneChange Menu::run(RenderWindow &window) {
Vector2f mouseScreenPosition = Vector2f(Mouse::getPosition(window));

if (playButton.getGlobalBounds().contains(Vector2f(mouseScreenPosition))) {
dynamic_cast<Game *>(getGamePtr())->newGame();
return {ScenesList::SCENE_GAME};
} else if (leaderboardButton.getGlobalBounds().contains(Vector2f(mouseScreenPosition))) {
return {ScenesList::SCENE_LEADERBOARD};
Expand Down

0 comments on commit 1c529d0

Please sign in to comment.