From 45f6021f82f8ba6844b5cdd3434b74bd7df2751a Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sat, 26 Nov 2022 20:15:22 +0000 Subject: [PATCH] Switched the engine to use a fixed delta in debug mode --- src/GameEngine.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GameEngine.c b/src/GameEngine.c index 704d576..6f7ec46 100644 --- a/src/GameEngine.c +++ b/src/GameEngine.c @@ -136,6 +136,10 @@ bool init_engine(const char *game_name, WindowSize window_size, GameEngine.delta = 0.0f; GameEngine.last_time = SDL_GetTicks64(); +#ifdef DEBUG_ENGINE + GameEngine.delta = 1.0f / 60.0f; +#endif /* DEBUG_ENGINE */ + #ifdef DEBUG_ENGINE printf("Game initialised successfully\n"); #endif /* DEBUG_ENGINE */ @@ -726,7 +730,9 @@ void update() { // Get the delta time in seconds since the SDL_GetTicks64() returns the // time in milliseconds +#ifndef DEBUG_ENGINE GameEngine.delta = (current_time - GameEngine.last_time) / 1000.0f; +#endif /* !DEBUG_ENGINE */ update_all_objects(GameEngine.object_store, GameEngine.delta);