From e957e96e207eb1a6aae275f8ce8dd2497ab4b88d Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 2 Jul 2021 17:36:05 +0200 Subject: [PATCH] Window corner sizes are now calculated based on the screen height instead of the screen width. --- es-core/src/components/NinePatchComponent.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index 8f2f39576..f8df08ef3 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -54,7 +54,12 @@ void NinePatchComponent::buildVertices() // Scale the corner size relative to the screen resolution, but keep the scale factor // within reason as extreme resolutions may cause artifacts. Any "normal" resolution // (e.g. from 720p to 4K) will be within these boundaries though. - float scaleFactor = Math::clamp(Renderer::getScreenWidthModifier(), 0.4f, 3.0f); + float scaleFactor; + if (Renderer::getScreenWidth() > Renderer::getScreenHeight()) + scaleFactor = Math::clamp(Renderer::getScreenHeightModifier(), 0.4f, 3.0f); + else + scaleFactor = Math::clamp(Renderer::getScreenWidthModifier(), 0.4f, 3.0f); + mTexture = TextureResource::get(mPath, false, false, true, scaleFactor); if (mTexture->getSize() == Vector2i::Zero()) {