shithub: cstory

Download patch

ref: ba069de70e15b28834e9b40aca179300284c9f5b
parent: b6774440b617c4f4aebc31bebef39b07ac5e752a
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Apr 9 20:45:57 EDT 2020

Fix window resizing

If you made the window square, the screen wouldn't be centered
properly.

--- a/src/Backends/GLFW3/Window-Software.cpp
+++ b/src/Backends/GLFW3/Window-Software.cpp
@@ -132,7 +132,7 @@
 	GLsizei viewport_width;
 	GLsizei viewport_height;
 
-	if (width > height)
+	if ((float)width / (float)height > (float)framebuffer_width / (float)framebuffer_height)
 	{
 		viewport_y = 0;
 		viewport_height = height;
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -669,7 +669,7 @@
 	GLsizei width;
 	GLsizei height;
 
-	if (actual_screen_width > actual_screen_height)
+	if ((float)actual_screen_width / (float)actual_screen_height > (float)framebuffer.width / (float)framebuffer.height)
 	{
 		y = 0;
 		height = actual_screen_height;