1. tick_rate() and fps.
- Posted by Mathew Hounsell <mat.hounsell at EXCITE.COM>
Nov 25, 1998
-
Last edited Nov 26, 1998
C & K L,
Try timing a single statement using
atom time_a
time_a = time()
-- Statement
time_a = time() - time_a
printf(1, "%0.15f", time_a )
You'll probablely get 0. Why? Because your computer is so fast that by the
time it had done the statement the clock hadn't changed. Speed up the clock
using a higher tick_rate() (It's about 18 normally) and it may actually
change before the instruction is done. DOS usually won't change the clock
more than once every 0.05 seconds.
The simplest way to time frames per second. Is to do...
atom until
until = time() + 60
integer count
count = 0
while time() < until do
-- Draw frame.
count = count + 1
end while
printf(1, "%d fps", count-1 )
This will tell you how many you can _complete_ .
--------------------
Sincerely,
Mathew Hounsell
Mat.Hounsell at Excite.Com
_______________________________________________________
Get your free, private e-mail at http://mail.excite.com/