diff options
author | 2014-04-03 03:19:21 +0000 | |
---|---|---|
committer | 2014-04-03 03:19:21 +0000 | |
commit | d812e93dec4bcb81c2b5226b14c54dacf4fb860d (patch) | |
tree | a7758c924c669b794330987f3387d471eadb5ca2 /hge/system.cpp | |
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 'hge/system.cpp')
-rw-r--r-- | hge/system.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/hge/system.cpp b/hge/system.cpp index b914566..b32783b 100644 --- a/hge/system.cpp +++ b/hge/system.cpp @@ -200,6 +200,9 @@ bool CALL HGE_Impl::System_Initiate() t0=t0fps=SDL_GetTicks(); dt=cfps=0; nFPS=0; + nFPSf=0.0f; + Fcnt=0; + fUpdateFPSDelay=0.0f; // Show splash @@ -320,6 +323,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 @@ -636,7 +646,6 @@ bool CALL HGE_Impl::System_Launch(const char *url) CFRelease(cfurl); return (err == noErr); #else - //STUBBED("launch URL"); char command[1024];sprintf(command,"xdg-open %s",url); system(command); return false; @@ -722,8 +731,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; |