depreciated framerate limiting
This commit is contained in:
parent
ff89f6786c
commit
5aaca5ef01
@ -13,7 +13,7 @@
|
||||
\brief Definition file for core ZEngine class.
|
||||
|
||||
ZEngine Game Engine core Engine definition.
|
||||
<br>$Id: ZE_ZEngine.h,v 1.55 2003/11/23 19:30:26 cozman Exp $<br>
|
||||
<br>$Id: ZE_ZEngine.h,v 1.56 2003/12/14 22:36:09 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -86,8 +86,12 @@ class ZEngine
|
||||
bool mPaused;
|
||||
//! Keep track of if ZEngine should unpause on active event.
|
||||
bool mUnpauseOnActive;
|
||||
|
||||
#ifdef DEPRECIATED
|
||||
//! Value framerate strives to be at, set by SetDesiredFramerate.
|
||||
Uint8 mDesiredFramerate;
|
||||
#endif //DEPRECIATED
|
||||
|
||||
//! Time scheduled for next update (used for framerate locked movement).
|
||||
Uint32 mNextUpdate;
|
||||
//! Keep track of time game was last paused.
|
||||
@ -304,6 +308,7 @@ class ZEngine
|
||||
**/
|
||||
double GetFramerate();
|
||||
|
||||
#ifdef DEPRECIATED
|
||||
/*!
|
||||
\brief Set Desired Framerate.
|
||||
|
||||
@ -323,6 +328,7 @@ class ZEngine
|
||||
\return Current setting for desired framerate.
|
||||
**/
|
||||
Uint8 GetDesiredFramerate();
|
||||
#endif //DEPRECIATED
|
||||
|
||||
/*!
|
||||
\brief Check Engine Paused State.
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Central source file for ZEngine.
|
||||
|
||||
Actual implementation of ZEngine singleton class, the core of ZEngine.
|
||||
<br>$Id: ZE_ZEngine.cpp,v 1.65 2003/11/24 02:21:20 cozman Exp $<br>
|
||||
<br>$Id: ZE_ZEngine.cpp,v 1.66 2003/12/14 22:36:50 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -29,7 +29,10 @@ ZEngine *ZEngine::sInstance=NULL;
|
||||
ZEngine::ZEngine() :
|
||||
mScreen(NULL), mFullscreen(true), mInitialized(false),
|
||||
mPaused(false), mUnpauseOnActive(false),
|
||||
mDesiredFramerate(0), mNextUpdate(0), mLastPause(0), mPausedTime(0), mLastTime(0),
|
||||
#ifdef DEPRECIATED
|
||||
mDesiredFramerate(0),
|
||||
#endif DEPRECIATED
|
||||
mNextUpdate(0), mLastPause(0), mPausedTime(0), mLastTime(0),
|
||||
mSecPerFrame(0.0),
|
||||
mNeedReload(false), mActive(false), mQuit(false), mKeyIsPressed(NULL),
|
||||
mMouseX(0), mMouseY(0), mMouseB(0),
|
||||
@ -281,6 +284,7 @@ void ZEngine::Update()
|
||||
mSecPerFrame = (GetTime()-mLastTime)/1000.0;
|
||||
mLastTime = GetTime();
|
||||
|
||||
#ifdef DEPRECIATED
|
||||
//framerate limiting//
|
||||
if(mDesiredFramerate)
|
||||
{
|
||||
@ -288,6 +292,7 @@ void ZEngine::Update()
|
||||
SDL_Delay(mNextUpdate-mLastTime);
|
||||
mNextUpdate = GetTime()+(1000/mDesiredFramerate);
|
||||
}
|
||||
#endif //DEPRECIATED
|
||||
}
|
||||
|
||||
#if (GFX_BACKEND == ZE_OGL)
|
||||
@ -377,6 +382,8 @@ double ZEngine::GetFramerate()
|
||||
return mSecPerFrame ? 1/mSecPerFrame : 0; //avoid /0
|
||||
}
|
||||
|
||||
#ifdef DEPRECIATED
|
||||
|
||||
void ZEngine::SetDesiredFramerate(Uint8 rate)
|
||||
{
|
||||
mDesiredFramerate = rate;
|
||||
@ -387,6 +394,8 @@ Uint8 ZEngine::GetDesiredFramerate()
|
||||
return mDesiredFramerate;
|
||||
}
|
||||
|
||||
#endif //DEPRECIATED
|
||||
|
||||
bool ZEngine::IsPaused()
|
||||
{
|
||||
return mPaused;
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZFontTest.cpp,v 1.18 2003/11/24 22:59:18 cozman Exp $*/
|
||||
/*$Id: ZFontTest.cpp,v 1.19 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZFontTest","bpp",32);
|
||||
fs = cfg.GetBool("ZFontTest","fullscreen",false);
|
||||
title = cfg.GetString("ZFontTest","title","ZFont Test");
|
||||
rate = cfg.GetInt("ZFontTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZImageTest.cpp,v 1.28 2003/11/24 22:59:18 cozman Exp $*/
|
||||
/*$Id: ZImageTest.cpp,v 1.29 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,9 +29,7 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZImageTest","bpp",32);
|
||||
fs = cfg.GetBool("ZImageTest","fullscreen",true);
|
||||
title = cfg.GetString("ZImageTest","title","ZImage Test");
|
||||
rate = cfg.GetInt("ZImageTest","framerate",60);
|
||||
|
||||
engine->SetDesiredFramerate(rate);
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
||||
@ -109,7 +107,7 @@ void Test()
|
||||
|
||||
engine->Clear(); //clear screen
|
||||
//draw the images//
|
||||
alpha += alphaDelta*engine->GetFrameTime();
|
||||
alpha += static_cast<float>(alphaDelta*engine->GetFrameTime());
|
||||
if(alpha >= 255 || alpha <= 0)
|
||||
alphaDelta *= -1.0f;
|
||||
image1.SetAlpha(static_cast<Uint8>(alpha));
|
||||
@ -117,7 +115,7 @@ void Test()
|
||||
|
||||
#if (GFX_BACKEND == ZE_OGL)
|
||||
image2.DrawRotated(100,0,angle);
|
||||
angle+=(150*engine->GetFrameTime());
|
||||
angle += static_cast<float>(150*engine->GetFrameTime());
|
||||
if(angle > 360)
|
||||
angle = 0.0f;
|
||||
#elif (GFX_BACKEND == ZE_SDL)
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZMouseTest.cpp,v 1.20 2003/11/24 22:59:18 cozman Exp $*/
|
||||
/*$Id: ZMouseTest.cpp,v 1.21 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZMouseTest","bpp",32);
|
||||
fs = cfg.GetBool("ZMouseTest","fullscreen",false);
|
||||
title = cfg.GetString("ZMouseTest","title","ZMouse Test");
|
||||
rate = cfg.GetInt("ZMouseTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZMusicTest.cpp,v 1.20 2003/11/24 22:59:18 cozman Exp $*/
|
||||
/*$Id: ZMusicTest.cpp,v 1.21 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZMusicTest","bpp",32);
|
||||
fs = cfg.GetBool("ZMusicTest","fullscreen",false);
|
||||
title = cfg.GetString("ZMusicTest","title","ZMusic Test");
|
||||
rate = cfg.GetInt("ZMusicTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZParticleTest.cpp,v 1.8 2003/11/24 01:58:23 cozman Exp $*/
|
||||
/*$Id: ZParticleTest.cpp,v 1.9 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZParticleTest","bpp",32);
|
||||
fs = cfg.GetBool("ZParticleTest","fullscreen",false);
|
||||
title = cfg.GetString("ZParticleTest","title","ZParticle Test");
|
||||
rate = cfg.GetInt("ZParticleTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZRectTest.cpp,v 1.21 2003/11/24 22:59:18 cozman Exp $*/
|
||||
/*$Id: ZRectTest.cpp,v 1.22 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZRectTest","bpp",32);
|
||||
fs = cfg.GetBool("ZRectTest","fullscreen",false);
|
||||
title = cfg.GetString("ZRectTest","title","ZRect Test");
|
||||
rate = cfg.GetInt("ZRectTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZSoundTest.cpp,v 1.20 2003/11/24 22:59:18 cozman Exp $*/
|
||||
/*$Id: ZSoundTest.cpp,v 1.21 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZSoundTest","bpp",32);
|
||||
fs = cfg.GetBool("ZSoundTest","fullscreen",false);
|
||||
title = cfg.GetString("ZSoundTest","title","ZSound Test");
|
||||
rate = cfg.GetInt("ZSoundTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
|
||||
and the home of this Library is http://www.zengine.sourceforge.net
|
||||
*******************************************************************************/
|
||||
|
||||
/*$Id: ZTimerTest.cpp,v 1.19 2003/11/24 02:17:32 cozman Exp $*/
|
||||
/*$Id: ZTimerTest.cpp,v 1.20 2003/12/14 22:35:35 cozman Exp $*/
|
||||
|
||||
#include <ZEngine.h>
|
||||
#include <string>
|
||||
@ -20,7 +20,7 @@ bool Initialize()
|
||||
{
|
||||
ZEngine *engine = ZEngine::GetInstance();
|
||||
ZConfigFile cfg("tests.zcf");
|
||||
int w,h,bpp,rate;
|
||||
int w,h,bpp;
|
||||
bool fs;
|
||||
std::string title;
|
||||
|
||||
@ -29,7 +29,6 @@ bool Initialize()
|
||||
bpp = cfg.GetInt("ZTimerTest","bpp",32);
|
||||
fs = cfg.GetBool("ZTimerTest","fullscreen",false);
|
||||
title = cfg.GetString("ZTimerTest","title","ZTimer Test");
|
||||
rate = cfg.GetInt("ZTimerTest","framerate",60);
|
||||
|
||||
return engine->CreateDisplay(w,h,bpp,fs,title);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user