diff options
author | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-04-03 03:19:21 +0000 |
---|---|---|
committer | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-04-03 03:19:21 +0000 |
commit | d812e93dec4bcb81c2b5226b14c54dacf4fb860d (patch) | |
tree | a7758c924c669b794330987f3387d471eadb5ca2 /hgewin | |
parent | 85923eb8a5d3f070618c3d6f94bea715c11a4227 (diff) | |
download | bullet-lab-remix-d812e93dec4bcb81c2b5226b14c54dacf4fb860d.tar.xz |
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.
Diffstat (limited to 'hgewin')
-rwxr-xr-x | hgewin/hge_impl.h | 4 | ||||
-rwxr-xr-x | hgewin/system.cpp | 14 | ||||
-rwxr-xr-x | hgewin/timer.cpp | 5 |
3 files changed, 21 insertions, 2 deletions
diff --git a/hgewin/hge_impl.h b/hgewin/hge_impl.h index e438b00..b3f0fe5 100755 --- a/hgewin/hge_impl.h +++ b/hgewin/hge_impl.h @@ -117,6 +117,7 @@ public: virtual float CALL Timer_GetTime(); virtual float CALL Timer_GetDelta(); virtual int CALL Timer_GetFPS(); + virtual float CALL Timer_GetFPSf(); virtual HEFFECT CALL Effect_Load(const char *filename, DWORD size=0); virtual void CALL Effect_Free(HEFFECT eff); @@ -335,8 +336,11 @@ public: // Timer float fTime; float fDeltaTime; + float fUpdateFPSDelay; + float nFPSf; DWORD nFixedDelta; int nFPS; + int Fcnt; DWORD t0, t0fps, dt; int cfps; 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; diff --git a/hgewin/timer.cpp b/hgewin/timer.cpp index af75315..13711c7 100755 --- a/hgewin/timer.cpp +++ b/hgewin/timer.cpp @@ -20,9 +20,12 @@ float CALL HGE_Impl::Timer_GetDelta() return fDeltaTime; } - int CALL HGE_Impl::Timer_GetFPS() { return nFPS; } +float CALL HGE_Impl::Timer_GetFPSf() +{ + return nFPSf; +} |