Skip to content

Commit

Permalink
Fix immediate exit when pressing escape
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Nov 6, 2013
1 parent 0ac9d19 commit c68666e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/cdogs/game.c
Expand Up @@ -462,10 +462,6 @@ int HandleKey(int cmd, int *isPaused)
JoyIsPressed(&gInputDevices.joysticks.joys[0], CMD_BUTTON4) ||
JoyIsPressed(&gInputDevices.joysticks.joys[1], CMD_BUTTON4))
{
if (!*isPaused)
{
*isPaused = 1;
}
return 1;
}
else if (KeyGetPressed(&gInputDevices.keyboard))
Expand Down Expand Up @@ -580,9 +576,16 @@ int gameloop(void)
GetPlayerCenter(&gGraphicsDevice, 1));
}
is_esc_pressed = HandleKey(cmd1 | cmd2, &isPaused);
if (is_esc_pressed && isPaused)
if (is_esc_pressed)
{
isDone = 1;
if (isPaused)
{
isDone = 1;
}
else
{
isPaused = 1;
}
}

if (!isPaused)
Expand Down

0 comments on commit c68666e

Please sign in to comment.