Lets make the DBPro Perftimer useful. The global "elaspedTime" here works great for timer based movement. * This code snippet is ported over from my C++ code and gives same results.
` Get Accurate Elasped Time
` BY: Todd Riggins - ExoDev.Com - Nov 12,2010
Kernel32 =1
load dll "kernel32.dll",Kernel32
global freq as double integer
global elaspedTime as double float
global oldTime as double integer
oldTime = perftimer()
memptr = make memory(16)
call dll Kernel32, "QueryPerformanceFrequency", memptr
freq = *memptr
set window on
sync on
sync rate 30
make camera 1
position camera 1,0,15,-400
color backdrop 1, rgb(32,64,64)
repeat
GetElapsedTime()
text 10, 30, "freq: "+str$(freq)
text 10, 50, "elaspedTime: "+str$(elaspedTime)
text 10, 70, "perftimer(): "+str$(perftimer())
sync
until escapekey()=1
end
Function GetElapsedTime()
local current as double integer
local loca as double float
local locb as double float
local locc as double float
current = perftimer()
loca=current
locb=oldTime
locc=freq
elaspedTime = (loca-locb)/locc
oldTime = perftimer()
if elaspedTime<0.0 then elaspedTime = 0.0
EndFunction
EDIT: Thanks for the editing the title