diff --git a/EmulatorRenderer.cpp b/EmulatorRenderer.cpp index d64440a..9af907f 100644 --- a/EmulatorRenderer.cpp +++ b/EmulatorRenderer.cpp @@ -438,7 +438,7 @@ namespace VBA10 } } - int height = this->height * (GetImageScale() / 100.0f); + int height = this->height; // *(GetImageScale() / 100.0f); int width; switch(GetAspectRatio()) { @@ -453,7 +453,7 @@ namespace VBA10 } break; case AspectRatioMode::Stretch: - width = this->width * (GetImageScale() / 100.0f); + width = this->width; //* (GetImageScale() / 100.0f); break; case AspectRatioMode::FourToThree: width = (int)(height * (4.0f / 3.0f)); @@ -465,7 +465,13 @@ namespace VBA10 width = height; break; } - //TO DO NEXT: fix the calculation of draw rect + + if (width > this->width) //fix the position of the image + { + height = height * 1.0f / width * this->width; + width = this->width; + } + int leftOffset = (this->width - width) / 2; RECT rect; rect.left = leftOffset; diff --git a/VirtualControllerInput.cpp b/VirtualControllerInput.cpp index dc68dff..685279e 100644 --- a/VirtualControllerInput.cpp +++ b/VirtualControllerInput.cpp @@ -1,6 +1,7 @@ #include "VirtualControllerInput.h" #include "Emulator.h" #include "EmulatorSettings.h" +#include //these positions are based on 1920x1080 #define CROSS_RECT_X 20 //distance from left side of screen to left side of button @@ -235,7 +236,7 @@ namespace VBA10 yOffset = VCONTROLLER_Y_OFFSET; } // 1920x1080 as reference value - float resolutionScale = this->emulator->GetHeight() / 1080.0f; + float resolutionScale = sqrt( this->emulator->GetHeight() / 1080.0f * this->emulator->GetWidth() / 1920.0f); yOffset *= resolutionScale; Windows::Foundation::Rect tmp;