From f9b27d7d01c40fb29cf727712eceadb2c37ca228 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 6 Aug 2023 22:04:22 +0200 Subject: [PATCH] port: match rendering resolution to window resolution, but keep 4:3 for now 16:9 requires some work --- port/fast3d/gfx_pc.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/port/fast3d/gfx_pc.cpp b/port/fast3d/gfx_pc.cpp index a9ab5508b..7d848814c 100644 --- a/port/fast3d/gfx_pc.cpp +++ b/port/fast3d/gfx_pc.cpp @@ -2555,11 +2555,19 @@ extern "C" void gfx_start_frame(void) { gfx_wapi->get_dimensions(&gfx_current_window_dimensions.width, &gfx_current_window_dimensions.height, &gfx_current_window_position_x, &gfx_current_window_position_y); - if (gfx_current_dimensions.height == 0) { + if (gfx_current_window_dimensions.height == 0) { // Avoid division by zero - gfx_current_dimensions.height = 1; + gfx_current_window_dimensions.height = 1; } - gfx_current_dimensions.aspect_ratio = (float)gfx_current_dimensions.width / (float)gfx_current_dimensions.height; + + // for now ensure that the game renders in a centered 4:3 window + // proper 16:9 support requires some fixes, namely the sky, fullscreen fades and room culling + gfx_current_dimensions.aspect_ratio = 4.0f / 3.0f; + gfx_current_dimensions.height = gfx_current_window_dimensions.height; + gfx_current_dimensions.width = gfx_current_dimensions.height * gfx_current_dimensions.aspect_ratio; + gfx_current_game_window_viewport.width = gfx_current_dimensions.width; + gfx_current_game_window_viewport.height = gfx_current_dimensions.height; + gfx_current_game_window_viewport.x = (gfx_current_window_dimensions.width - gfx_current_dimensions.width) / 2; if (gfx_current_dimensions.height != gfx_prev_dimensions.height) { for (auto& fb : framebuffers) {