summaryrefslogtreecommitdiff
path: root/gfx-app/include
diff options
context:
space:
mode:
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*);