mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-04 02:24:00 +00:00
Remove TimeUpdateType enum and related code. Dynamic timestep was used all the time anyway.
This commit is contained in:
parent
9bb4226626
commit
15c7776763
2 changed files with 1 additions and 71 deletions
|
@ -329,11 +329,8 @@ Core::Core(const std::string &filesystem, const std::string& extraDataDir, int n
|
||||||
{
|
{
|
||||||
sound = NULL;
|
sound = NULL;
|
||||||
screenCapScale = Vector(1,1,1);
|
screenCapScale = Vector(1,1,1);
|
||||||
timeUpdateType = TIMEUPDATE_DYNAMIC;
|
|
||||||
_extraDataDir = extraDataDir;
|
_extraDataDir = extraDataDir;
|
||||||
|
|
||||||
fixedFPS = 60;
|
|
||||||
|
|
||||||
if (userDataSubFolder.empty())
|
if (userDataSubFolder.empty())
|
||||||
userDataSubFolder = appName;
|
userDataSubFolder = appName;
|
||||||
|
|
||||||
|
@ -1575,30 +1572,17 @@ void Core::main(float runTime)
|
||||||
bool wasInactive = false;
|
bool wasInactive = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
nowTicks = thenTicks = SDL_GetTicks();
|
nowTicks = thenTicks = SDL_GetTicks();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nestedMains++;
|
nestedMains++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while((runTime == -1 && !loopDone) || (runTime >0))
|
while((runTime == -1 && !loopDone) || (runTime >0))
|
||||||
{
|
{
|
||||||
BBGE_PROF(Core_main);
|
BBGE_PROF(Core_main);
|
||||||
|
|
||||||
|
nowTicks = SDL_GetTicks();
|
||||||
|
|
||||||
if (timeUpdateType == TIMEUPDATE_DYNAMIC)
|
|
||||||
{
|
|
||||||
nowTicks = SDL_GetTicks();
|
|
||||||
}
|
|
||||||
|
|
||||||
dt = (nowTicks-thenTicks)/1000.0;
|
dt = (nowTicks-thenTicks)/1000.0;
|
||||||
thenTicks = nowTicks;
|
thenTicks = nowTicks;
|
||||||
|
|
||||||
|
|
||||||
if (verbose) debugLog("avgFPS");
|
if (verbose) debugLog("avgFPS");
|
||||||
if (!avgFPS.empty())
|
if (!avgFPS.empty())
|
||||||
{
|
{
|
||||||
|
@ -1696,12 +1680,6 @@ void Core::main(float runTime)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (timeUpdateType == TIMEUPDATE_FIXED)
|
|
||||||
{
|
|
||||||
real_dt = dt;
|
|
||||||
dt = 1.0f/float(fixedFPS);
|
|
||||||
}
|
|
||||||
|
|
||||||
old_dt = dt;
|
old_dt = dt;
|
||||||
|
|
||||||
if (verbose) debugLog("modify dt");
|
if (verbose) debugLog("modify dt");
|
||||||
|
@ -1798,39 +1776,6 @@ void Core::main(float runTime)
|
||||||
saveScreenshotTGA(getScreenshotFilename());
|
saveScreenshotTGA(getScreenshotFilename());
|
||||||
prepScreen(0);
|
prepScreen(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait
|
|
||||||
if (timeUpdateType == TIMEUPDATE_FIXED)
|
|
||||||
{
|
|
||||||
static float avg_diff=0;
|
|
||||||
static int avg_diff_count=0;
|
|
||||||
|
|
||||||
float diff = (1.0f/float(fixedFPS)) - real_dt;
|
|
||||||
|
|
||||||
avg_diff_count++;
|
|
||||||
avg_diff += diff;
|
|
||||||
|
|
||||||
char buf[256];
|
|
||||||
sprintf(buf, "real_dt: %5.4f \n realFPS: %5.4f \n fixedFPS: %5.4f \n diff: %5.4f \n delay: %5.4f \n avgdiff: %5.8f", float(real_dt), float(real_dt>0?(1.0f/real_dt):0.0f), float(fixedFPS), float(diff), float(diff*1000), float(avg_diff/(float)avg_diff_count));
|
|
||||||
fpsDebugString = buf;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nowTicks = SDL_GetTicks();
|
|
||||||
|
|
||||||
if (diff > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
while ((SDL_GetTicks() - nowTicks) < (diff*1000))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (verbose) debugLog("bottom of function");
|
if (verbose) debugLog("bottom of function");
|
||||||
quitNestedMainFlag = false;
|
quitNestedMainFlag = false;
|
||||||
|
|
15
BBGE/Core.h
15
BBGE/Core.h
|
@ -55,12 +55,6 @@ std::string getInputCodeToString(int key);
|
||||||
std::string getInputCodeToUserString(int key);
|
std::string getInputCodeToUserString(int key);
|
||||||
int getStringToInputCode(const std::string &string);
|
int getStringToInputCode(const std::string &string);
|
||||||
|
|
||||||
enum TimeUpdateType
|
|
||||||
{
|
|
||||||
TIMEUPDATE_DYNAMIC = 0,
|
|
||||||
TIMEUPDATE_FIXED = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ScreenMode
|
struct ScreenMode
|
||||||
{
|
{
|
||||||
ScreenMode() { idx = x = y = hz = 0; }
|
ScreenMode() { idx = x = y = hz = 0; }
|
||||||
|
@ -708,11 +702,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::string fpsDebugString;
|
|
||||||
|
|
||||||
TimeUpdateType timeUpdateType;
|
|
||||||
int fixedFPS;
|
|
||||||
|
|
||||||
void updateCullData();
|
void updateCullData();
|
||||||
|
|
||||||
std::string userDataFolder;
|
std::string userDataFolder;
|
||||||
|
@ -760,7 +749,6 @@ protected:
|
||||||
void shutdownSoundLibrary();
|
void shutdownSoundLibrary();
|
||||||
|
|
||||||
int afterEffectManagerLayer;
|
int afterEffectManagerLayer;
|
||||||
bool sortEnabled;
|
|
||||||
Vector cameraOffset;
|
Vector cameraOffset;
|
||||||
std::vector<float> avgFPS;
|
std::vector<float> avgFPS;
|
||||||
virtual void modifyDt(float &dt){}
|
virtual void modifyDt(float &dt){}
|
||||||
|
@ -774,9 +762,6 @@ protected:
|
||||||
bool clearedGarbageFlag;
|
bool clearedGarbageFlag;
|
||||||
int nestedMains;
|
int nestedMains;
|
||||||
std::string baseTextureDirectory;
|
std::string baseTextureDirectory;
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
|
||||||
__int64 lastTime, curTime, freq;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::ofstream _logOut;
|
std::ofstream _logOut;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue