diff --git a/pong.c b/pong.c index 9c04682..a90cc8d 100644 --- a/pong.c +++ b/pong.c @@ -32,7 +32,7 @@ int main(int argc, char** argv) { al_register_event_source(queue,al_get_keyboard_event_source()); ALLEGRO_COLOR black = al_map_rgba(0,0,0,255); ALLEGRO_COLOR white = al_map_rgba(255,255,255,255); - ALLEGRO_EVENT event; + ALLEGRO_EVENT temp_event; ALLEGRO_FONT* main_font = al_load_ttf_font("/usr/share/fonts/cantarell/Cantarell-VF.otf", 30, 0); bool running = false; @@ -69,8 +69,8 @@ int main(int argc, char** argv) { al_flip_display(); do { - al_wait_for_event(queue, &event); - } while (!(event.type == ALLEGRO_EVENT_KEY_DOWN && event.keyboard.keycode == ALLEGRO_KEY_SPACE)); + al_wait_for_event(queue, &temp_event); + } while (!(temp_event.type == ALLEGRO_EVENT_KEY_DOWN && temp_event.keyboard.keycode == ALLEGRO_KEY_SPACE)); running = true; @@ -81,6 +81,7 @@ int main(int argc, char** argv) { al_flip_display(); while (running) { + ALLEGRO_EVENT event; // Code borrowed from: https://stackoverflow.com/a/30078011 while (!al_is_event_queue_empty(queue)) {