From e10b84c4b90b78abc6ac31d2a1983b58c50842ba Mon Sep 17 00:00:00 2001 From: Rockingcool Date: Sat, 30 Dec 2023 23:54:56 -0600 Subject: [PATCH] Working on fixing the 'ball position' bug (turns out it isn't actually fixed) --- pong.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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)) {