FPS ReadOut

Blitz3D Forums/Blitz3D Programming/FPS ReadOut

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Well, typically I increment some variable once per RenderWorld, then after one second that variable is the FPS. Then, normally, I reset that variable to 0 so I can restart the increment. Like this is what I use:

Global fps,timenext,frames

Function GetFPS(JustChecking = False)   ;pass True to JustChecking if you just want it to return the FPS and not increment the frames variable
                                        ;probably a good choice is to do is right after your RenderWorld GetFPS(False) and then somewhere else do Text X,Y,GetFPS(True)
	If Not JustChecking Then frames = frames+1

	If MilliSecs() > timenext Then
		timenext = MilliSecs()+1000
		fps = frames
		frames = 0
	EndIf

	Return fps
End Function