Type TFrameManager Field fps:Int Field ftimer:Int Field fdelay:Int Field readydraw:Int=False Field frametimer:Int Field tframecount:Int Field framecount:Int Method Create:TFrameManager(maxframes:Int) If maxframes<1 maxframes=1 fps=maxframes ftimer=MilliSecs() fdelay=Int(1000/maxframes) frametimer=MilliSecs() tframecount=0 framecount=0 Return Self EndMethod Method SetMaxFrames(maxframes:Int) If maxframes<1 maxframes=1 fps=maxframes ftimer=MilliSecs() fdelay=Int(1000/maxframes) frametimer=MilliSecs() tframecount=0 framecount=0 EndMethod Method Update() Local newt:Int=MilliSecs() If newt >= (ftimer+fdelay) tframecount:+1 readydraw=True ftimer=MilliSecs() EndIf If newt >= (frametimer+1000) framecount=tframecount tframecount=0 frametimer=MilliSecs() EndIf EndMethod Method ReadyToDraw:Int() If readydraw=True readydraw=False Return True Else Return False EndIf EndMethod Method GetFPS:Int() Return framecount EndMethod Method Delete() fps=Null ftimer=Null fdelay=Null readydraw=Null frametimer=Null tframecount=Null framecount=Null EndMethodEndTypeFunction CreateFrameManager:TFrameManager(maxframes:Int=30) Return New TFrameManager.Create(maxframes)EndFunction