From 4659a4cd49633fba71c9f368059fb4f95a9a8f9c Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Tue, 25 Oct 2022 00:57:59 +0100 Subject: [PATCH] Added function that returns the current time in milliseconds --- include/GameEngine.h | 2 ++ src/GameEngine.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/GameEngine.h b/include/GameEngine.h index 5c4ac72..55d14d2 100644 --- a/include/GameEngine.h +++ b/include/GameEngine.h @@ -28,6 +28,8 @@ bool init_engine(const char *game_name, WindowSize window_size, bool game_running(); void close_engine(); + +int64_t get_time(); // END GENERAL ENGINE API // ASSET MANAGEMENT API diff --git a/src/GameEngine.c b/src/GameEngine.c index 023c4d8..c5e63a7 100644 --- a/src/GameEngine.c +++ b/src/GameEngine.c @@ -172,6 +172,8 @@ void close_engine() { #endif /* DEBUG_ENGINE */ } +int64_t get_time() { return SDL_GetTicks64(); } + ObjectID add_object(void *object, EventHandlerPtr event_handler, UpdateFuncPtr update_func, RenderFuncPtr render_func) { if (!(GameEngine.running) || !(GameEngine.object_store)) {