From d812e93dec4bcb81c2b5226b14c54dacf4fb860d Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Thu, 3 Apr 2014 03:19:21 +0000 Subject: Remove "high FPS mode", it won't reach 500 FPS on my computer any more. Replace it with Vsync mode. Add float HGE::Timer_GetFPSf(). The return value will be updated every 1000ms. --- hgewin/system.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'hgewin/system.cpp') diff --git a/hgewin/system.cpp b/hgewin/system.cpp index 1e49d65..9dfda86 100755 --- a/hgewin/system.cpp +++ b/hgewin/system.cpp @@ -167,6 +167,9 @@ bool CALL HGE_Impl::System_Initiate() t0=t0fps=timeGetTime(); dt=cfps=0; nFPS=0; + nFPSf=0.0f; + Fcnt=0; + fUpdateFPSDelay=0.0f; // Show splash @@ -305,7 +308,13 @@ bool CALL HGE_Impl::System_Start() nFPS=cfps; cfps=0; t0fps=t0; _UpdatePowerStatus(); } - + ++Fcnt;fUpdateFPSDelay+=fDeltaTime; + if(fUpdateFPSDelay>1) + { + nFPSf=Fcnt/fUpdateFPSDelay; + fUpdateFPSDelay=0.0f; + Fcnt=0; + } // Do user's stuff if(procFrameFunc()) break; @@ -685,8 +694,11 @@ HGE_Impl::HGE_Impl() nHGEFPS=HGEFPS_UNLIMITED; fTime=0.0f; + fUpdateFPSDelay=0.0f; fDeltaTime=0.0f; nFPS=0; + nFPSf=0.0f; + Fcnt=0; procFrameFunc=0; procRenderFunc=0; -- cgit v1.2.3