From 456d7f883ca34ec83692ff3879ca5f5717e82b33 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 2 May 2026 14:59:18 -0700 Subject: Use the simloop library --- app/include/gfx/app.h | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'app/include') diff --git a/app/include/gfx/app.h b/app/include/gfx/app.h index 3017707..42fccec 100644 --- a/app/include/gfx/app.h +++ b/app/include/gfx/app.h @@ -5,13 +5,13 @@ typedef struct GfxAppState GfxAppState; /// Application settings. typedef struct GfxAppDesc { - int argc; // Number of application arguments. - const char** argv; // Application arguments. - int width; // Window width. - int height; // Window height. - int max_fps; // Desired maximum display framerate. 0 to disable. - double update_delta_time; // Desired delta time between frame updates. - const char* title; // Window title. + int argc; // Number of application arguments. + const char** argv; // Application arguments. + int width; // Window width. + int height; // Window height. + int update_fps; // Desired frame update frequency. + int max_render_fps; // Desired maximum render frame rate. 0 to disable. + const char* title; // Window title. GfxAppState* app_state; } GfxAppDesc; @@ -88,24 +88,24 @@ bool gfx_app_is_key_pressed(GfxApp*, Key); /// Define a main function that initializes and puts the application in a loop. /// See also: gfx_app_run(). -#define GFX_APP_MAIN(WIDTH, HEIGHT, MAX_FPS, TITLE) \ - int main(int argc, const char** argv) { \ - GfxAppState app_state = {0}; \ - gfx_app_run( \ - &(GfxAppDesc){ \ - .argc = argc, \ - .argv = argv, \ - .width = WIDTH, \ - .height = HEIGHT, \ - .max_fps = MAX_FPS, \ - .update_delta_time = MAX_FPS > 0 ? 1.0 / (double)MAX_FPS : 0.0, \ - .title = TITLE, \ - .app_state = &app_state, \ - }, \ - &(GfxAppCallbacks){.init = Init, \ - .shutdown = Shutdown, \ - .update = Update, \ - .render = Render, \ - .resize = Resize}); \ - return 0; \ +#define GFX_APP_MAIN(WIDTH, HEIGHT, UPDATE_FPS, MAX_RENDER_FPS, TITLE) \ + int main(int argc, const char** argv) { \ + GfxAppState app_state = {0}; \ + gfx_app_run( \ + &(GfxAppDesc){ \ + .argc = argc, \ + .argv = argv, \ + .width = WIDTH, \ + .height = HEIGHT, \ + .update_fps = UPDATE_FPS, \ + .max_render_fps = MAX_RENDER_FPS, \ + .title = TITLE, \ + .app_state = &app_state, \ + }, \ + &(GfxAppCallbacks){.init = Init, \ + .shutdown = Shutdown, \ + .update = Update, \ + .render = Render, \ + .resize = Resize}); \ + return 0; \ } -- cgit v1.2.3