aboutsummaryrefslogtreecommitdiff
path: root/app/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2026-05-02 14:59:18 -0700
committer3gg <3gg@shellblade.net>2026-05-02 14:59:18 -0700
commit456d7f883ca34ec83692ff3879ca5f5717e82b33 (patch)
tree9bc29d8aa999d98d220419bbf87a02e9639afc64 /app/include
parent5c7204d7b334855b18761ba95f61fea0aefddd52 (diff)
Use the simloop libraryHEADmain
Diffstat (limited to 'app/include')
-rw-r--r--app/include/gfx/app.h54
1 files changed, 27 insertions, 27 deletions
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;
5 5
6/// Application settings. 6/// Application settings.
7typedef struct GfxAppDesc { 7typedef struct GfxAppDesc {
8 int argc; // Number of application arguments. 8 int argc; // Number of application arguments.
9 const char** argv; // Application arguments. 9 const char** argv; // Application arguments.
10 int width; // Window width. 10 int width; // Window width.
11 int height; // Window height. 11 int height; // Window height.
12 int max_fps; // Desired maximum display framerate. 0 to disable. 12 int update_fps; // Desired frame update frequency.
13 double update_delta_time; // Desired delta time between frame updates. 13 int max_render_fps; // Desired maximum render frame rate. 0 to disable.
14 const char* title; // Window title. 14 const char* title; // Window title.
15 GfxAppState* app_state; 15 GfxAppState* app_state;
16} GfxAppDesc; 16} GfxAppDesc;
17 17
@@ -88,24 +88,24 @@ bool gfx_app_is_key_pressed(GfxApp*, Key);
88 88
89/// Define a main function that initializes and puts the application in a loop. 89/// Define a main function that initializes and puts the application in a loop.
90/// See also: gfx_app_run(). 90/// See also: gfx_app_run().
91#define GFX_APP_MAIN(WIDTH, HEIGHT, MAX_FPS, TITLE) \ 91#define GFX_APP_MAIN(WIDTH, HEIGHT, UPDATE_FPS, MAX_RENDER_FPS, TITLE) \
92 int main(int argc, const char** argv) { \ 92 int main(int argc, const char** argv) { \
93 GfxAppState app_state = {0}; \ 93 GfxAppState app_state = {0}; \
94 gfx_app_run( \ 94 gfx_app_run( \
95 &(GfxAppDesc){ \ 95 &(GfxAppDesc){ \
96 .argc = argc, \ 96 .argc = argc, \
97 .argv = argv, \ 97 .argv = argv, \
98 .width = WIDTH, \ 98 .width = WIDTH, \
99 .height = HEIGHT, \ 99 .height = HEIGHT, \
100 .max_fps = MAX_FPS, \ 100 .update_fps = UPDATE_FPS, \
101 .update_delta_time = MAX_FPS > 0 ? 1.0 / (double)MAX_FPS : 0.0, \ 101 .max_render_fps = MAX_RENDER_FPS, \
102 .title = TITLE, \ 102 .title = TITLE, \
103 .app_state = &app_state, \ 103 .app_state = &app_state, \
104 }, \ 104 }, \
105 &(GfxAppCallbacks){.init = Init, \ 105 &(GfxAppCallbacks){.init = Init, \
106 .shutdown = Shutdown, \ 106 .shutdown = Shutdown, \
107 .update = Update, \ 107 .update = Update, \
108 .render = Render, \ 108 .render = Render, \
109 .resize = Resize}); \ 109 .resize = Resize}); \
110 return 0; \ 110 return 0; \
111 } 111 }