From 585d0f7931d5d02e4153813d57cd19607352c557 Mon Sep 17 00:00:00 2001 From: Samo Pajk Date: Wed, 23 Sep 2015 10:52:25 +0200 Subject: [PATCH] Fixed bug with wrong screen size detection in GameWindows that was caused by rounding issues --- Classes/Retronator/Xni/Framework/GameWindow.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Retronator/Xni/Framework/GameWindow.m b/Classes/Retronator/Xni/Framework/GameWindow.m index df8c7f7..bd3397b 100644 --- a/Classes/Retronator/Xni/Framework/GameWindow.m +++ b/Classes/Retronator/Xni/Framework/GameWindow.m @@ -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.