Is this weird or am I tired?
Posted: Thu Nov 24, 2005 4:04 am
				
				Without any delay this code gives me 1100 FPS.
With a delay of just 1ms this gives me only 64 FPS.
Is this weird or am I just tired?
 
			With a delay of just 1ms this gives me only 64 FPS.
Is this weird or am I just tired?
Code: Select all
InitKeyboard(): InitSprite()
OpenScreen(640,480,16,"FPS Test")
Procedure.l GetFPS()
  Static Time, Frames, FPS
  
  Frames + 1
  
  If ElapsedMilliseconds()-Time >= 1000
    Time = ElapsedMilliseconds()
    FPS = Frames
    Frames = 0
  EndIf
  
  ProcedureReturn FPS
EndProcedure
Repeat
  FlipBuffers(0)
  ClearScreen(255,255,255)
  
  StartDrawing(ScreenOutput())
    Locate(10,10)
    DrawText(Str(GetFPS()))
  StopDrawing()
  
  ExamineKeyboard()
  Delay(1)
Until KeyboardPushed(#PB_Key_Escape)