I would like this program to rotate the cube the same speed with different frame-rates It works but it's not realtime, it's measured in seconds and I don't know another way without lowering the "FPS_MilliCount >= 1000" part and lowering the "sync#=60/FPS_Current#" but that gets very inaccurate
;Catchup test
;Left click caps to 60
;Left click caps to 30
;Box should rotate at the same speed
Graphics3D(800,600,32,2)
camera=CreateCamera()
cube=CreateCube()
PositionEntity(cube, 0, 0, 4)
light=CreateLight(1)
;FPS counter
;FPS counter
Global FPS_FrameCount# = 0
Global FPS_MilliCount# = MilliSecs()
Global FPS_Current# = 60
Global sync#=1
Function FPS_Update()
FPS_FrameCount = FPS_FrameCount + 1
;DebugLog(MilliSecs() - FPS_MilliCount)
If(MilliSecs() - FPS_MilliCount >= 1000)
FPS_Current = FPS_FrameCount
FPS_FrameCount = 0
FPS_MilliCount = MilliSecs()
sync#=60/FPS_Current#
AppTitle DEF_Title + " FPS: " + FPS_Current# + " SYNC: " + sync
EndIf
End Function
;~IDEal Editor Parameters:
;~C#Blitz3D
Global cap=CreateTimer(60)
Global cap2=CreateTimer(30)
ClearTextureFilters()
tex=LoadTexture("shiny.png"); Optional, this is a high res texture I was using
EntityTexture(cube,tex)
Global capper# = 1
While(Not KeyDown(1))
FPS_Update()
TurnEntity(cube, 1*sync, 1*sync, 1*sync)
UpdateWorld()
RenderWorld()
;Text 0,0, Time#()
If(MouseDown(1))
WaitTimer(cap)
EndIf
If(MouseDown(2))
WaitTimer(cap2)
EndIf
Flip False
Wend
Is there some complex way of using millisecs to measure skipped frames?
|