Thanks for the replies, but I'm still stuck here. The problem is:
if(ev.type == ALLEGRO_EVENT_TIMER)
redraw = true;
if(redraw)// && al_is_event_queue_empty(event_queue))
redraw = false;
ed -> animate(&ev);
The problem is that I have to get the commands inside ev->animate(&ev). But the queue must be emptied to redraw, and if the queue is emptied, the event is gone!
I'm thinking in storing the events in a structure before the redraw and pass it to the function, but there are some simpler manner?
I made that structure. I'll share de code, can be useful to others:
pos = -1;
i = 0;
pos != -1)
28 return true;
31 return false;
Using it is pretty easy.
Instance the class out of the main loop:
keyEvent * kE = new keyEvent();
Then, place the following line in the main loop:
if(ev.type == ALLEGRO_EVENT_KEY_DOWN)
So, you can pass a pointer to the class to anywhere and get the pressed key by invoking
Is easy to integrate to any application... I like it