aboutsummaryrefslogtreecommitdiff
path: root/app/include
diff options
context:
space:
mode:
Diffstat (limited to 'app/include')
-rw-r--r--app/include/gfx/app.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/app/include/gfx/app.h b/app/include/gfx/app.h
index 77b6ad2..639fa2d 100644
--- a/app/include/gfx/app.h
+++ b/app/include/gfx/app.h
@@ -1,7 +1,6 @@
1#pragma once 1#pragma once
2 2
3#include <stdbool.h> 3typedef struct GfxApp GfxApp;
4
5typedef struct GfxAppState GfxAppState; 4typedef struct GfxAppState GfxAppState;
6 5
7/// Application settings. 6/// Application settings.
@@ -16,11 +15,11 @@ typedef struct GfxAppDesc {
16 GfxAppState* app_state; 15 GfxAppState* app_state;
17} GfxAppDesc; 16} GfxAppDesc;
18 17
19typedef bool (*GfxAppInit)(GfxAppState*, int argc, const char** argv); 18typedef bool (*GfxAppInit)(GfxApp*, GfxAppState*, int argc, const char** argv);
20typedef void (*GfxAppShutdown)(GfxAppState*); 19typedef void (*GfxAppShutdown)(GfxApp*, GfxAppState*);
21typedef void (*GfxAppUpdate)(GfxAppState*, double t, double dt); 20typedef void (*GfxAppUpdate)(GfxApp*, GfxAppState*, double t, double dt);
22typedef void (*GfxAppRender)(GfxAppState*); 21typedef void (*GfxAppRender)(const GfxApp*, GfxAppState*);
23typedef void (*GfxAppResize)(GfxAppState*, int width, int height); 22typedef void (*GfxAppResize)(GfxApp*, GfxAppState*, int width, int height);
24 23
25/// Application callback functions. 24/// Application callback functions.
26typedef struct GfxAppCallbacks { 25typedef struct GfxAppCallbacks {
@@ -74,13 +73,13 @@ extern "C" {
74bool gfx_app_run(const GfxAppDesc*, const GfxAppCallbacks*); 73bool gfx_app_run(const GfxAppDesc*, const GfxAppCallbacks*);
75 74
76/// Get the mouse coordinates relative to the app's window. 75/// Get the mouse coordinates relative to the app's window.
77void gfx_app_get_mouse_position(double* x, double* y); 76void gfx_app_get_mouse_position(GfxApp*, double* x, double* y);
78 77
79/// Return if the given mouse button is pressed. 78/// Return if the given mouse button is pressed.
80bool gfx_app_is_mouse_button_pressed(MouseButton); 79bool gfx_app_is_mouse_button_pressed(GfxApp*, MouseButton);
81 80
82/// Return true if the given key is pressed. 81/// Return true if the given key is pressed.
83bool gfx_app_is_key_pressed(Key); 82bool gfx_app_is_key_pressed(GfxApp*, Key);
84 83
85#ifdef __cplusplus 84#ifdef __cplusplus
86} // extern "C" 85} // extern "C"
@@ -102,11 +101,10 @@ bool gfx_app_is_key_pressed(Key);
102 .title = TITLE, \ 101 .title = TITLE, \
103 .app_state = &app_state, \ 102 .app_state = &app_state, \
104 }, \ 103 }, \
105 &(GfxAppCallbacks){ \ 104 &(GfxAppCallbacks){.init = Init, \
106 .init = (GfxAppInit)Init, \ 105 .shutdown = Shutdown, \
107 .shutdown = (GfxAppShutdown)Shutdown, \ 106 .update = Update, \
108 .update = (GfxAppUpdate)Update, \ 107 .render = Render, \
109 .render = (GfxAppRender)Render, \ 108 .resize = Resize}); \
110 .resize = (GfxAppResize)Resize}); \
111 return 0; \ 109 return 0; \
112 } 110 }