diff options
author | 3gg <3gg@shellblade.net> | 2025-09-01 14:50:37 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-09-01 14:50:37 -0700 |
commit | 3f91c1d9edb6cd7c251b51c18a5db54fe185ffed (patch) | |
tree | de5df333389825dde02b631178f71a616d0d3982 /demos/checkerboard | |
parent | db3fd5aac9c66e64aa56fabc1a865fb64a65fc1c (diff) |
Update to match new gfx-app
Diffstat (limited to 'demos/checkerboard')
-rw-r--r-- | demos/checkerboard/checkerboard.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/demos/checkerboard/checkerboard.c b/demos/checkerboard/checkerboard.c index b408fc2..0c8ff37 100644 --- a/demos/checkerboard/checkerboard.c +++ b/demos/checkerboard/checkerboard.c | |||
@@ -66,9 +66,9 @@ static void make_checkerboard(IsoGfx* iso, Tile black, Tile white) { | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | static bool init(GfxAppState* state, int argc, const char** argv) { | 69 | static bool init(GfxApp* app, GfxAppState* state, int argc, const char** argv) { |
70 | assert(app); | ||
70 | assert(state); | 71 | assert(state); |
71 | |||
72 | (void)argc; | 72 | (void)argc; |
73 | (void)argv; | 73 | (void)argv; |
74 | 74 | ||
@@ -100,14 +100,16 @@ static bool init(GfxAppState* state, int argc, const char** argv) { | |||
100 | return true; | 100 | return true; |
101 | } | 101 | } |
102 | 102 | ||
103 | static void shutdown(GfxAppState* state) { | 103 | static void shutdown(GfxApp* app, GfxAppState* state) { |
104 | assert(app); | ||
104 | assert(state); | 105 | assert(state); |
105 | 106 | ||
106 | iso_backend_shutdown(&state->backend); | 107 | iso_backend_shutdown(&state->backend); |
107 | isogfx_del(&state->iso); | 108 | isogfx_del(&state->iso); |
108 | } | 109 | } |
109 | 110 | ||
110 | static void update(GfxAppState* state, double t, double dt) { | 111 | static void update(GfxApp* app, GfxAppState* state, double t, double dt) { |
112 | assert(app); | ||
111 | assert(state); | 113 | assert(state); |
112 | (void)dt; | 114 | (void)dt; |
113 | 115 | ||
@@ -117,7 +119,7 @@ static void update(GfxAppState* state, double t, double dt) { | |||
117 | 119 | ||
118 | // Get mouse position in window coordinates. | 120 | // Get mouse position in window coordinates. |
119 | double mouse_x, mouse_y; | 121 | double mouse_x, mouse_y; |
120 | gfx_app_get_mouse_position(&mouse_x, &mouse_y); | 122 | gfx_app_get_mouse_position(app, &mouse_x, &mouse_y); |
121 | 123 | ||
122 | // Map from window coordinates to virtual screen coordinates. | 124 | // Map from window coordinates to virtual screen coordinates. |
123 | iso_backend_get_mouse_position( | 125 | iso_backend_get_mouse_position( |
@@ -128,7 +130,8 @@ static void update(GfxAppState* state, double t, double dt) { | |||
128 | printf("Picked tile: (%d, %d)\n", state->xpick, state->ypick); | 130 | printf("Picked tile: (%d, %d)\n", state->xpick, state->ypick); |
129 | } | 131 | } |
130 | 132 | ||
131 | static void render(GfxAppState* state) { | 133 | static void render(const GfxApp* app, GfxAppState* state) { |
134 | assert(app); | ||
132 | assert(state); | 135 | assert(state); |
133 | 136 | ||
134 | IsoGfx* iso = state->iso; | 137 | IsoGfx* iso = state->iso; |
@@ -142,7 +145,8 @@ static void render(GfxAppState* state) { | |||
142 | iso_backend_render(state->backend, iso); | 145 | iso_backend_render(state->backend, iso); |
143 | } | 146 | } |
144 | 147 | ||
145 | static void resize(GfxAppState* state, int width, int height) { | 148 | static void resize(GfxApp* app, GfxAppState* state, int width, int height) { |
149 | assert(app); | ||
146 | assert(state); | 150 | assert(state); |
147 | 151 | ||
148 | iso_backend_resize_window(state->backend, state->iso, width, height); | 152 | iso_backend_resize_window(state->backend, state->iso, width, height); |