| View previous topic :: View next topic |
| Author |
Message |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Mon Jan 23, 2006 9:37 pm Post subject: Framerate how? |
|
|
Hi folks,
I have a question. How can you calculate the framerate?
i need the function that get the current time.
this way i can save it loop through the game 1 frame. compare the new time with the old time. see how much time has passed in 1 frame with that i can calculate the steps of my enemies and there speed.
what function do i need to get the time?
greets Ghoti _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
weltall
Joined: 20 Feb 2004 Posts: 310
|
Posted: Wed Jan 25, 2006 3:43 am Post subject: |
|
|
you could use the cputicks or the timer function which were posted somewhere around with a timer manager.
you could also measure vsinc which are of a precise number/s for the same standard (they differs beetween pal and ntsc) |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Thu Jan 26, 2006 5:57 am Post subject: |
|
|
Woops, I swore I replied to this the other day...
There is a cdReadClock call that will return the current time, however it is an EXTREMELY expensive call and should be avoided.
Setting up a timer is probably the most accurate and one of the fastest (performancewise) ways to go..
For an example, I think quake_ps2 uses timers to track the time, but I haven't looked so I could be wrong and I dunno if it's a good example or not.
Counting vblanks is an easy way to setup, but you have to worry about what TV standard is being used. _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Thu Jan 26, 2006 6:52 am Post subject: |
|
|
Um... wow. The answer would be entirely different then :P _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
|