fps rate

Blitz3D Forums/Blitz3D Beginners Area/fps rate

RogueM(Posted 2007) [#1]
I have looked at several other posts that tell how to set
the frame rate, but it's usually confusing or spread out.
Can anyone give me a just-fps-code solution?


H&K(Posted 2007) [#2]
Const FPS=30
period=1000/FPS
time=MilliSecs()-period

While Not KeyHit(1)
	
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	;how many 'frames' have elapsed	
	ticks=elapsed/period
	
	;fractional remainder
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

		UpdateGame()
		UpdateWorld
	
		Next
	Next
	
	RenderWorld tween
	Flip
	
Wend


see samples,mak, castle demo


RogueM(Posted 2007) [#3]
thanks