summaryrefslogtreecommitdiff
path: root/gfx-app/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2023-01-03 08:49:54 -0800
committer3gg <3gg@shellblade.net>2023-01-03 08:49:54 -0800
commit1e3fcf5b38d67fb54102786be74af42be5c6792f (patch)
tree88bff4e24121c50d0e3c62f5ddb4eff6a3dfa238 /gfx-app/include
Initial commit.
Diffstat (limited to 'gfx-app/include')
-rw-r--r--gfx-app/include/gfx/gfx_app.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/gfx-app/include/gfx/gfx_app.h b/gfx-app/include/gfx/gfx_app.h
new file mode 100644
index 0000000..bdb3550
--- /dev/null
+++ b/gfx-app/include/gfx/gfx_app.h
@@ -0,0 +1,23 @@
1#pragma once
2
3#include <stdbool.h>
4
5typedef struct GfxAppDesc {
6 int argc; // Number of application arguments.
7 const char** argv; // Application arguments.
8 int width; // Window width.
9 int height; // Window height.
10 int max_fps; // Desired maximum framerate. 0 to disable.
11 double update_delta_time; // Desired delta time between frame updates.
12} GfxAppDesc;
13
14typedef struct GfxAppCallbacks {
15 bool (*init)(const GfxAppDesc*, void** app_state);
16 void (*update)(void* app_state, double t, double dt);
17 void (*render)(void* app_state);
18 void (*resize)(void* app_state, int width, int height);
19 void (*shutdown)(void* app_state);
20} GfxAppCallbacks;
21
22/// Create a window with an OpenGL context and run the main loop.
23bool gfx_app_run(const GfxAppDesc*, const GfxAppCallbacks*);