Permalink
Browse files

Fix mouse.x == 59 exiting game

  • Loading branch information...
adabo committed Mar 7, 2018
1 parent 893bfc7 commit 7e9e17e160a3ad31012a157540e06a6a6ced0dde
Showing with 4 additions and 3 deletions.
  1. +3 −3 AllegroTest/game.cpp
  2. +1 −0 AllegroTest/game.h
View
@@ -141,8 +141,7 @@ void Game::handle_key_press()
if (s_key_is_down) player.y += player.y_speed;
if (a_key_is_down) player.x -= player.x_speed;
if (d_key_is_down) player.x += player.x_speed;
if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
game_is_running = false;
if (esc_key_is_down) game_is_running = false;
//if (t_was_pressed) t_toggle = !t_toggle;
if (player_is_out_of_bounds(&player)) {
@@ -157,7 +156,7 @@ void Game::store_key_state()
case ALLEGRO_KEY_S: s_key_is_down = true; break;
case ALLEGRO_KEY_A: a_key_is_down = true; break;
case ALLEGRO_KEY_D: d_key_is_down = true; break;
case ALLEGRO_KEY_ESCAPE: game_is_running = false; break;
case ALLEGRO_KEY_ESCAPE: esc_key_is_down = true; break;
default: break;
}
}
@@ -167,6 +166,7 @@ void Game::store_key_state()
case ALLEGRO_KEY_S: s_key_is_down = false; break;
case ALLEGRO_KEY_A: a_key_is_down = false; break;
case ALLEGRO_KEY_D: d_key_is_down = false; break;
case ALLEGRO_KEY_ESCAPE: esc_key_is_down = false; break;
default: break;
}
}
View
@@ -42,6 +42,7 @@ class Game
bool s_key_is_down;
bool a_key_is_down;
bool d_key_is_down;
bool esc_key_is_down;
bool t_toggle;
bool t_is_pressed;
bool game_is_running;

0 comments on commit 7e9e17e

Please sign in to comment.