Skip to content

Commit

Permalink
bugfix: propper state clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Billocap committed Jan 28, 2024
1 parent 8b36735 commit c4522ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ namespace std
{
if (this->game->finished)
{
int x = event->x - this->game->get_grid()->width;
int y = event->y - 1;
string message = this->game->won ? "You Won" : "You Lost";

int x = event->x - (message.size() / 2);
int y = event->y - 1;

render_state(message, x, y);
}

Expand Down Expand Up @@ -130,6 +131,9 @@ namespace std
{
this->resume();

this->finished = false;
this->won = false;

switch (diff)
{
case D_EASY:
Expand Down

0 comments on commit c4522ab

Please sign in to comment.