Reset delta time when ending a transition.

This commit is contained in:
Steve 2016-04-26 08:16:15 +01:00
parent 3b8001d265
commit f0868c7a29
4 changed files with 12 additions and 0 deletions

View File

@ -103,8 +103,15 @@ int main(int argc, char *argv[])
while (td >= LOGIC_RATE) while (td >= LOGIC_RATE)
{ {
app.delegate.logic(); app.delegate.logic();
td -= LOGIC_RATE; td -= LOGIC_RATE;
if (app.resetTimeDelta)
{
td = 0;
then = SDL_GetTicks();
}
game.stats[STAT_TIME]++; game.stats[STAT_TIME]++;
} }

View File

@ -443,6 +443,7 @@ typedef struct {
} Mouse; } Mouse;
typedef struct { typedef struct {
int resetTimeDelta;
char saveDir[MAX_FILENAME_LENGTH]; char saveDir[MAX_FILENAME_LENGTH];
int winWidth; int winWidth;
int winHeight; int winHeight;

View File

@ -43,4 +43,6 @@ void endSectionTransition(void)
{ {
SDL_Delay(elasped); SDL_Delay(elasped);
} }
app.resetTimeDelta = 1;
} }

View File

@ -24,3 +24,5 @@ extern void prepareScene(void);
extern void presentScene(void); extern void presentScene(void);
extern void clearInput(void); extern void clearInput(void);
extern void expireTexts(int all); extern void expireTexts(int all);
extern App app;