summaryrefslogtreecommitdiff
path: root/game/src/game.c
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-02-08 07:58:22 -0800
committer3gg <3gg@shellblade.net>2024-02-08 07:58:22 -0800
commitd130c2c7314cf4884f444db16d7717b7356b54ff (patch)
tree19080622054c32b5e09b5f455b4a8490e7ae6048 /game/src/game.c
parentdda4b3e598c7c955a44e3874bf2c57bd16b1c3ea (diff)
Add window width and height to game.
Diffstat (limited to 'game/src/game.c')
-rw-r--r--game/src/game.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/game/src/game.c b/game/src/game.c
index 64be4f3..c720656 100644
--- a/game/src/game.c
+++ b/game/src/game.c
@@ -197,6 +197,10 @@ void app_update(Game* game, double t, double dt) {
197 shutdown_plugin(game); 197 shutdown_plugin(game);
198 const bool result = init_plugin(game); 198 const bool result = init_plugin(game);
199 assert(result); // TODO: handle error better. 199 assert(result); // TODO: handle error better.
200
201 // Trigger a resize just like the initial resize that occurs when the gfx
202 // application starts.
203 resize_plugin(game, game->width, game->height);
200 } 204 }
201 205
202 update_plugin(game, t, dt); 206 update_plugin(game, t, dt);
@@ -210,6 +214,12 @@ void app_render(const Game* game) {
210} 214}
211 215
212void app_resize(Game* game, int width, int height) { 216void app_resize(Game* game, int width, int height) {
217 game->width = width;
218 game->height = height;
219
220 RenderBackend* render_backend = gfx_get_render_backend(game->gfx);
221 gfx_set_viewport(render_backend, width, height);
222
213 resize_plugin(game, width, height); 223 resize_plugin(game, width, height);
214} 224}
215 225