From d130c2c7314cf4884f444db16d7717b7356b54ff Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 8 Feb 2024 07:58:22 -0800 Subject: Add window width and height to game. --- game/src/game.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'game/src/game.c') 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) { shutdown_plugin(game); const bool result = init_plugin(game); assert(result); // TODO: handle error better. + + // Trigger a resize just like the initial resize that occurs when the gfx + // application starts. + resize_plugin(game, game->width, game->height); } update_plugin(game, t, dt); @@ -210,6 +214,12 @@ void app_render(const Game* game) { } void app_resize(Game* game, int width, int height) { + game->width = width; + game->height = height; + + RenderBackend* render_backend = gfx_get_render_backend(game->gfx); + gfx_set_viewport(render_backend, width, height); + resize_plugin(game, width, height); } -- cgit v1.2.3