Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] Timer events

This thread is locked; no one can reply to it. rss feed Print
[A5] Timer events
boNltt
Member #15,051
April 2013

Hello, i recently started out with Allegro and game programming in general so i don't really get all the concepts yet so sorry if this is a bad question.

I've read up a bit about interpolation and handling of frame skipping on the forums and i think i get most of it, except one part which i would like to get a bit of clarity on.

The general way of determining interpolation values seem to be
interpolation = (al_get_time() - offset - gametime) / dt

and for calculating gametime there seems to usually be something in the form of
gametime = event.timer.count * dt

Now the thing i'm having a bit trouble with is what event.timer.count refers to.

Is it the time since the timer itself started counting? The time it has been sitting in the queue?

Would love to get some clarity on this.

Thanks in advance.

SiegeLord
Member #7,827
October 2006
avatar

It increments by 1 every time an ALLEGRO_EVENT_TIMER is triggered, and it starts at 0 when the timer is created. You can also reset it via al_set_timer_count, so it's not quite as simple as simply saying "number of times it ticked since being started".

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: