Showing Framerate with DrawText()?

BlitzMax Forums/BlitzMax Programming/Showing Framerate with DrawText()?

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.

Something like this should work (untested tho). All it does is count the number of screen updates, then store the result in a separate var at the end of each second:
Global FramesPerSec:int
Global FrameCounter:int
Global Start:int

While Not KeyDown(KEY_ESCAPE)
  'do stuff
  UpdateFrameCounter()
  DrawText "FPS: " + FramesPerSec,10,10
  Flip
Wend

Function UpdateFrameCounter()
  FrameCounter:+1
  If Millisecs() > Start + 1000
    Start = Millisecs()
    FramesPerSec = FrameCounter
    FrameCounter = 0
  EndIf
End Function