Working on fixing the 'ball position' bug (turns out it isn't actually fixed)
This commit is contained in:
7
pong.c
7
pong.c
@@ -32,7 +32,7 @@ int main(int argc, char** argv) {
|
|||||||
al_register_event_source(queue,al_get_keyboard_event_source());
|
al_register_event_source(queue,al_get_keyboard_event_source());
|
||||||
ALLEGRO_COLOR black = al_map_rgba(0,0,0,255);
|
ALLEGRO_COLOR black = al_map_rgba(0,0,0,255);
|
||||||
ALLEGRO_COLOR white = al_map_rgba(255,255,255,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);
|
ALLEGRO_FONT* main_font = al_load_ttf_font("/usr/share/fonts/cantarell/Cantarell-VF.otf", 30, 0);
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
@@ -69,8 +69,8 @@ int main(int argc, char** argv) {
|
|||||||
al_flip_display();
|
al_flip_display();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
al_wait_for_event(queue, &event);
|
al_wait_for_event(queue, &temp_event);
|
||||||
} while (!(event.type == ALLEGRO_EVENT_KEY_DOWN && event.keyboard.keycode == ALLEGRO_KEY_SPACE));
|
} while (!(temp_event.type == ALLEGRO_EVENT_KEY_DOWN && temp_event.keyboard.keycode == ALLEGRO_KEY_SPACE));
|
||||||
|
|
||||||
running = true;
|
running = true;
|
||||||
|
|
||||||
@@ -81,6 +81,7 @@ int main(int argc, char** argv) {
|
|||||||
al_flip_display();
|
al_flip_display();
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
|
ALLEGRO_EVENT event;
|
||||||
// Code borrowed from: https://stackoverflow.com/a/30078011
|
// Code borrowed from: https://stackoverflow.com/a/30078011
|
||||||
|
|
||||||
while (!al_is_event_queue_empty(queue)) {
|
while (!al_is_event_queue_empty(queue)) {
|
||||||
|
Reference in New Issue
Block a user