Search code examples
timerallegroallegro5

How to use multiple timers in allegro?


if( ev.type == ALLEGRO_EVENT_TIMER)

This is the statement in the event loop to check if the incoming event is a timer event.

But all timers would generate this same event, so how do you have multiple timers going at once? How do you differentiate them?


Solution

  • The event is a union. See all the properties here.

    You want ev.timer.source (or ev.any.source).