From 1e3fcf5b38d67fb54102786be74af42be5c6792f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 3 Jan 2023 08:49:54 -0800 Subject: Initial commit. --- gfx-app/include/gfx/gfx_app.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gfx-app/include/gfx/gfx_app.h (limited to 'gfx-app/include') 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 @@ +#pragma once + +#include + +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 framerate. 0 to disable. + double update_delta_time; // Desired delta time between frame updates. +} GfxAppDesc; + +typedef struct GfxAppCallbacks { + bool (*init)(const GfxAppDesc*, void** app_state); + void (*update)(void* app_state, double t, double dt); + void (*render)(void* app_state); + void (*resize)(void* app_state, int width, int height); + void (*shutdown)(void* app_state); +} GfxAppCallbacks; + +/// Create a window with an OpenGL context and run the main loop. +bool gfx_app_run(const GfxAppDesc*, const GfxAppCallbacks*); -- cgit v1.2.3