FPS (60)

Blitz3D Forums/Blitz3D Programming/FPS (60)

Yue(Posted 2010) [#1]
Hello, someone please tell me how to implement a code of not passing the 60 frames per second.

A greeting.


Warner(Posted 2010) [#2]
Maybe this code entry helps?
http://www.blitzmax.com/codearcs/codearcs.php?code=9


_Skully(Posted 2010) [#3]
There are a couple ways:

global T:TTimer=CreateTimer(60)

While not Keydown(KEY_ESCAPE)
   WaitEvent()
   if EventSource()=T RunGame()
Wend

Function RunGame()
...
End Function


or look at implementing an actually timing system which is a lot more complicated but gives you much more control over smoothing etc.


Vorderman(Posted 2010) [#4]
Try this framework, it's what I always use :

if locks the logic at 60fps and tries to maintain a 60fps render speed, so even if you get rendering slowdown your logic is always at 60fps, so your game always plays the same no matter how slowly (or quickly) it's rendering.

The main resolution constants are defined at the top, GFX_fullscreen allows windowed (2) or fullscreen (1) mode.

It has a central TYPE called "TYPE_game" that holds all the variables, other type instances etc.., which simulates having STRICT functionality in B3D.




Pinete(Posted 2010) [#5]
Great Framework Vorderman! ;)