1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00

Fixed bug with wrong screen size detection in GameWindows that was caused by rounding issues

This commit is contained in:
Samo Pajk 2015-09-23 10:52:25 +02:00
parent 8f094a4048
commit 585d0f7931

View File

@ -100,17 +100,17 @@
clientHeight = realFrame.size.height * realScale;
}
float targetAspectRatio = (float)clientWidth/(float)clientHeight;
double targetAspectRatio = (float)clientWidth/(float)clientHeight;
CGRect targetFrame;
if (targetAspectRatio >= realAspectRatio) {
// Add black borders on top and bottom.
targetFrame.size.width = realFrame.size.width ;
targetFrame.size.height = targetFrame.size.width / targetAspectRatio;
targetFrame.size.height = roundf(targetFrame.size.width / targetAspectRatio);
} else {
// Add black borders on left and right.
targetFrame.size.height = realFrame.size.height;
targetFrame.size.width = targetFrame.size.height * targetAspectRatio;
targetFrame.size.width = roundf(targetFrame.size.height * targetAspectRatio);
}
// Center the window.