fixed minor timer irregularities

This commit is contained in:
James Turk 2003-03-17 04:23:20 +00:00
parent a3befd7877
commit 2acdd2243c

View File

@ -13,7 +13,7 @@
File: ZE_ZEngine.cpp <br> File: ZE_ZEngine.cpp <br>
Description: Implementation source file for ZEngine library main singleton class. <br> Description: Implementation source file for ZEngine library main singleton class. <br>
Author(s): James Turk <br> Author(s): James Turk <br>
$Id: ZE_ZEngine.cpp,v 1.30 2003/03/01 20:47:00 cozman Exp $<br> $Id: ZE_ZEngine.cpp,v 1.31 2003/03/17 04:23:20 cozman Exp $<br>
\file ZE_ZEngine.cpp \file ZE_ZEngine.cpp
\brief Central source file for ZEngine. \brief Central source file for ZEngine.
@ -250,7 +250,7 @@ bool ZEngine::CreateDisplay(string title, string icon)
#endif //USE_SDL_NET #endif //USE_SDL_NET
if(!mInitialized) if(!mInitialized)
mLastTime = mPausedTime = SDL_GetTicks(); mPausedTime = SDL_GetTicks();
mActive = true; mActive = true;
mInitialized = true; //if it makes it to the end it has been initialized mInitialized = true; //if it makes it to the end it has been initialized
@ -319,6 +319,7 @@ void ZEngine::Update()
{ {
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
WriteLog(FormatStr("mSec = %f \t mLastTime=%d",mSecPerFrame,mLastTime));
mSecPerFrame = (GetTime()-mLastTime)/1000.0; mSecPerFrame = (GetTime()-mLastTime)/1000.0;
mLastTime = GetTime(); mLastTime = GetTime();
@ -399,7 +400,7 @@ double ZEngine::GetFrameTime()
double ZEngine::GetFramerate() double ZEngine::GetFramerate()
{ {
return 1/mSecPerFrame; return mSecPerFrame ? 1/mSecPerFrame : 0;
} }
void ZEngine::SetDesiredFramerate(Uint8 rate) void ZEngine::SetDesiredFramerate(Uint8 rate)