Yes, I get that too. It's reporting the actual speed of the game loop and not the Amount of Renders Per Second. The reason being that we've told the application to only render to screen when the ScreenUpdate variable reaches a certain threshold, thus we already know what the maximum amount of rendered FPS will be. If the Rendered FPS dips below the ScreenUpdate threshold then it will be reported as Rendered FPS and not number of application loops per second.
If you take out the ScreenUpdate checks then you will get the REAL ACTUAL Rendered FPS.
Oh and I recently updated the Delta code, it's a lot more accurate now and faster :D
@Deux, I use this method as it's good OOP practice, it keeps everything nice and neat. I may also need multiple Delta Timers controlling different things - this code gives me the flexibility.
If you take out the ScreenUpdate checks then you will get the REAL ACTUAL Rendered FPS.
Oh and I recently updated the Delta code, it's a lot more accurate now and faster :D
Graphics 800,600,32,NOSYNC AutoMidHandle True Type DeltaTime Global DeltaTList :TList Field OldTime :Int Field ElapsedTime :Int Field dFps :Float Field dDelta :Float Field CurrFps :Int Field FPSCounter :Int Field CurrTime :Int Field CheckTime :Int Method New () If DeltaTList = Null Then DeltaTList = New TList DeltaTList.AddLast Self End Method Method Destroy () DeltaTList.Remove Self End Method Function Create:DeltaTime(Fps:Float) Local dTime:DeltaTime = New DeltaTime dTime.dFps = Fps dTime.dDelta = 1000/Fps Return dTime End Function Method Update() Self.CurrTime = MilliSecs() Self.ElapsedTime = Self.CurrTime - Self.OldTime Self.OldTime = Self.CurrTime If Self.CurrTime > Self.CheckTime Self.CheckTime = Self.CurrTime + 1000 Self.CurrFps = Self.FPSCounter Self.FPSCounter = 0 Else Self.FPSCounter:+1 EndIf End Method Method FPS() Return Self.CurrFps End Method Method CurrDelta:Float() Return Double(Self.ElapsedTime)/Self.dDelta End Method Method SetFPS(NewFPS:Float) Self.dFPS = NewFPS Self.dDelta = 1000/Self.dFPS End Method End Type SetMaskColor(255,0,255) 'Global blob:TImage = LoadImage("C:\blitzmax\samples\simonh\fireworks\spark.png") Global Delta1:DeltaTime = DeltaTime.Create(35.0) ' Normal 35 FPS Local Delta:Double Global ScreenUpdate:Double Global bx:Double=10 While Not KeyHit(KEY_ESCAPE) Delta1.Update() Delta = Delta1.CurrDelta() If Delta > 1 Then Delta = 1 ' Delta should never be bigger than 1. ' -------------------------------GFX FUNCTIONS --------------------------- ScreenUpdate = ScreenUpdate + Delta If ScreenUpdate > 0.30 Then Cls RenderGFX(ScreenUpdate) ScreenUpdate :- 0.3 Flip EndIf ' ------------------------------------------------------------------------ FlushMem Wend Function RenderGFX(Delta:Double=1) DrawOval bx,100,10,10 bx=bx+(Delta * 2) DrawText Delta1.FPS()+" FPS",10,10 If bx>799 Then bx = 0 End Function
@Deux, I use this method as it's good OOP practice, it keeps everything nice and neat. I may also need multiple Delta Timers controlling different things - this code gives me the flexibility.