Original Post
🔒 Locked
Timer Implementation
Advertisement
im not sure i know what you mean, but simple timing is done like this:
you measure how long time a frame takes, like this: (guess this is what you mean by a timer)
framestart = timeGetTime()
.. render and do all stuff..
frametime = timeGetTime() - framestart
then to calculate, for example motion, you do like this:
newposition = oldposition + speed * frametime
its all simple physics:
s = v * t
(distance = speed * time)
you measure how long time a frame takes, like this: (guess this is what you mean by a timer)
framestart = timeGetTime()
.. render and do all stuff..
frametime = timeGetTime() - framestart
then to calculate, for example motion, you do like this:
newposition = oldposition + speed * frametime
its all simple physics:
s = v * t
(distance = speed * time)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement