PDA

View Full Version : Another Day, Another Question. Frames Per Second



Arius Myst
27-09-2003, 12:14 PM
I can't work out how the samples obtain the frame rate??

I can get it myself using timers but thats somewhat messy. Could somebody explain to me how this is done please?

tux
27-09-2003, 06:15 PM
basicly, have a global integer. increment it on every render. then every second, print out the number and set back to 0.

theres a better way but thats the best way to get u started :)

Avatar
27-09-2003, 07:02 PM
Here si the code I use :



var // global
Time : Cardinal;
FPS : Cardinal;

[...]

[Procedure render]

if GetTickCount - 1000 > Time then
Begin
// Print FPS
FPS := 0;
Time := GetTickCount;
end
else inc(FPS);

Arius Myst
28-09-2003, 12:33 PM
Ahh course, I never thought of using TickCount. Before i was using the same method but a timer to count the seconds ;)

Thnx guys