From 6744f519c5f136531080b86929e09aebb5c13775 Mon Sep 17 00:00:00 2001 From: Nimac0 Date: Mon, 29 Apr 2024 23:00:20 +0200 Subject: [PATCH] ref(popup window): remove popup window code from main.cpp and game.cpp --- src/Game.cpp | 32 ++++++++++++++++---------------- src/main.cpp | 16 ---------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/Game.cpp b/src/Game.cpp index f7785e1..e7ac1d4 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -354,19 +354,19 @@ Entity::TeamLabel Game::getWinner() const return this->winner; } -void Game::refreshPlayers() { - - for(auto& p : projectiles) { - p->destroy(); - } - - player1.getComponent().position = Vector2D(80, 80); - player2.getComponent().position = Vector2D(600, 500); - - player1.getComponent().setHealth(5); - player2.getComponent().setHealth(5); - - isRunning = true; - - update(); -} +//void Game::refreshPlayers() { +// +// for(auto& p : projectiles) { +// p->destroy(); +// } +// +// player1.getComponent().position = Vector2D(80, 80); +// player2.getComponent().position = Vector2D(600, 500); +// +// player1.getComponent().setHealth(5); +// player2.getComponent().setHealth(5); +// +// isRunning = true; +// +// update(); +//} diff --git a/src/main.cpp b/src/main.cpp index 1b59151..ce47941 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ int main(int argc, char* argv[]) game = new Game(); game->init("No_Name_Chicken_Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_SIZE_WIDTH, SCREEN_SIZE_HEIGHT, false); - while(playing) { while (game->running()) { frameStart = SDL_GetTicks(); @@ -35,21 +34,6 @@ int main(int argc, char* argv[]) SDL_Delay(frameDelay - frameTime); } } - Entity::TeamLabel winner = game->getWinner(); - - PopupWindow popupWindow("Game over", winner == Entity::TeamLabel::BLUE ? - "Player1 won! Press 'C' to continue or 'Q' to quit." : - "Player2 won! Press 'C' to continue or 'Q' to quit."); - - popupWindow.renderWinnerPopup(winner); - - while (!popupWindow.interacted) { - popupWindow.handleWinnerEvents(); - SDL_Delay(10); - } - playing = popupWindow.shouldContinue(); - game->refreshPlayers(); - } game->clean();