mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
port: match rendering resolution to window resolution, but keep 4:3 for now
16:9 requires some work
This commit is contained in:
1 parent
885bfeaf38
commit
f9b27d7d01
1 file changed
+11
-3
+11
-3
@@ -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_wapi->get_dimensions(&gfx_current_window_dimensions.width, &gfx_current_window_dimensions.height,
|
||||||
&gfx_current_window_position_x, &gfx_current_window_position_y);
|
&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
|
// 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) {
|
if (gfx_current_dimensions.height != gfx_prev_dimensions.height) {
|
||||||
for (auto& fb : framebuffers) {
|
for (auto& fb : framebuffers) {
|
||||||
|
|||||||
Reference in new issue
Block a user