mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-03 18:14:01 +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;
|
||||
screenCapScale = Vector(1,1,1);
|
||||
timeUpdateType = TIMEUPDATE_DYNAMIC;
|
||||
_extraDataDir = extraDataDir;
|
||||
|
||||
fixedFPS = 60;
|
||||
|
||||
if (userDataSubFolder.empty())
|
||||
userDataSubFolder = appName;
|
||||
|
||||
|
@ -1575,30 +1572,17 @@ void Core::main(float runTime)
|
|||
bool wasInactive = false;
|
||||
#endif
|
||||
|
||||
|
||||
nowTicks = thenTicks = SDL_GetTicks();
|
||||
|
||||
|
||||
|
||||
nestedMains++;
|
||||
|
||||
|
||||
|
||||
while((runTime == -1 && !loopDone) || (runTime >0))
|
||||
{
|
||||
BBGE_PROF(Core_main);
|
||||
|
||||
|
||||
|
||||
if (timeUpdateType == TIMEUPDATE_DYNAMIC)
|
||||
{
|
||||
nowTicks = SDL_GetTicks();
|
||||
}
|
||||
|
||||
nowTicks = SDL_GetTicks();
|
||||
dt = (nowTicks-thenTicks)/1000.0;
|
||||
thenTicks = nowTicks;
|
||||
|
||||
|
||||
if (verbose) debugLog("avgFPS");
|
||||
if (!avgFPS.empty())
|
||||
{
|
||||
|
@ -1696,12 +1680,6 @@ void Core::main(float runTime)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (timeUpdateType == TIMEUPDATE_FIXED)
|
||||
{
|
||||
real_dt = dt;
|
||||
dt = 1.0f/float(fixedFPS);
|
||||
}
|
||||
|
||||
old_dt = dt;
|
||||
|
||||
if (verbose) debugLog("modify dt");
|
||||
|
@ -1798,39 +1776,6 @@ void Core::main(float runTime)
|
|||
saveScreenshotTGA(getScreenshotFilename());
|
||||
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");
|
||||
quitNestedMainFlag = false;
|
||||
|
|
15
BBGE/Core.h
15
BBGE/Core.h
|
@ -55,12 +55,6 @@ std::string getInputCodeToString(int key);
|
|||
std::string getInputCodeToUserString(int key);
|
||||
int getStringToInputCode(const std::string &string);
|
||||
|
||||
enum TimeUpdateType
|
||||
{
|
||||
TIMEUPDATE_DYNAMIC = 0,
|
||||
TIMEUPDATE_FIXED = 1
|
||||
};
|
||||
|
||||
struct ScreenMode
|
||||
{
|
||||
ScreenMode() { idx = x = y = hz = 0; }
|
||||
|
@ -708,11 +702,6 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
std::string fpsDebugString;
|
||||
|
||||
TimeUpdateType timeUpdateType;
|
||||
int fixedFPS;
|
||||
|
||||
void updateCullData();
|
||||
|
||||
std::string userDataFolder;
|
||||
|
@ -760,7 +749,6 @@ protected:
|
|||
void shutdownSoundLibrary();
|
||||
|
||||
int afterEffectManagerLayer;
|
||||
bool sortEnabled;
|
||||
Vector cameraOffset;
|
||||
std::vector<float> avgFPS;
|
||||
virtual void modifyDt(float &dt){}
|
||||
|
@ -774,9 +762,6 @@ protected:
|
|||
bool clearedGarbageFlag;
|
||||
int nestedMains;
|
||||
std::string baseTextureDirectory;
|
||||
#ifdef BBGE_BUILD_WINDOWS
|
||||
__int64 lastTime, curTime, freq;
|
||||
#endif
|
||||
|
||||
std::ofstream _logOut;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue