Switched the engine to use a fixed delta in debug mode

This commit is contained in:
abdelrahman committed 2022-11-26 20:15:22 +00:00
1 parent b2f4c60e14
commit 45f6021f82
1 file changed
+6
+6
View File
@@ -136,6 +136,10 @@ bool init_engine(const char *game_name, WindowSize window_size,
GameEngine.delta = 0.0f; GameEngine.delta = 0.0f;
GameEngine.last_time = SDL_GetTicks64(); GameEngine.last_time = SDL_GetTicks64();
#ifdef DEBUG_ENGINE
GameEngine.delta = 1.0f / 60.0f;
#endif /* DEBUG_ENGINE */
#ifdef DEBUG_ENGINE #ifdef DEBUG_ENGINE
printf("Game initialised successfully\n"); printf("Game initialised successfully\n");
#endif /* DEBUG_ENGINE */ #endif /* DEBUG_ENGINE */
@@ -726,7 +730,9 @@ void update() {
// Get the delta time in seconds since the SDL_GetTicks64() returns the // Get the delta time in seconds since the SDL_GetTicks64() returns the
// time in milliseconds // time in milliseconds
#ifndef DEBUG_ENGINE
GameEngine.delta = (current_time - GameEngine.last_time) / 1000.0f; GameEngine.delta = (current_time - GameEngine.last_time) / 1000.0f;
#endif /* !DEBUG_ENGINE */
update_all_objects(GameEngine.object_store, GameEngine.delta); update_all_objects(GameEngine.object_store, GameEngine.delta);