Add upright boolean for portrait mode

This commit is contained in:
Kleidis 2025-03-11 15:21:51 +01:00
parent cb9406f6a3
commit 2282f6f3cf
3 changed files with 8 additions and 5 deletions

View File

@ -201,7 +201,8 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po
switch (portrait_layout_option) { switch (portrait_layout_option) {
case Settings::PortraitLayoutOption::PortraitTopFullWidth: case Settings::PortraitLayoutOption::PortraitTopFullWidth:
layout = Layout::PortraitTopFullFrameLayout(width, height, layout = Layout::PortraitTopFullFrameLayout(width, height,
Settings::values.swap_screen.GetValue()); Settings::values.swap_screen.GetValue(),
Settings::values.upright_screen.GetValue());
break; break;
case Settings::PortraitLayoutOption::PortraitCustomLayout: case Settings::PortraitLayoutOption::PortraitCustomLayout:
layout = Layout::CustomFrameLayout( layout = Layout::CustomFrameLayout(

View File

@ -39,11 +39,11 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool swapped, bool u
Settings::SmallScreenPosition::BelowLarge); Settings::SmallScreenPosition::BelowLarge);
} }
FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool swapped) { FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool swapped, bool upright) {
ASSERT(width > 0); ASSERT(width > 0);
ASSERT(height > 0); ASSERT(height > 0);
const float scale_factor = swapped ? 1.25f : 0.8f; const float scale_factor = swapped ? 1.25f : 0.8f;
FramebufferLayout res = LargeFrameLayout(width, height, swapped, false, scale_factor, FramebufferLayout res = LargeFrameLayout(width, height, swapped, upright, scale_factor,
Settings::SmallScreenPosition::BelowLarge); Settings::SmallScreenPosition::BelowLarge);
const int shiftY = -(int)(swapped ? res.bottom_screen.top : res.top_screen.top); const int shiftY = -(int)(swapped ? res.bottom_screen.top : res.top_screen.top);
res.top_screen = res.top_screen.TranslateY(shiftY); res.top_screen = res.top_screen.TranslateY(shiftY);
@ -365,7 +365,8 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
width = Core::kScreenTopWidth * res_scale; width = Core::kScreenTopWidth * res_scale;
height = (Core::kScreenTopHeight + Core::kScreenBottomHeight) * res_scale; height = (Core::kScreenTopHeight + Core::kScreenBottomHeight) * res_scale;
return PortraitTopFullFrameLayout(width, height, return PortraitTopFullFrameLayout(width, height,
Settings::values.swap_screen.GetValue()); Settings::values.swap_screen.GetValue(),
Settings::values.upright_screen.GetValue());
} }
} else { } else {
auto layout_option = Settings::values.layout_option.GetValue(); auto layout_option = Settings::values.layout_option.GetValue();

View File

@ -69,7 +69,8 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool is_swapped, boo
* @param is_swapped if true, the bottom screen will be displayed above the top screen * @param is_swapped if true, the bottom screen will be displayed above the top screen
* @return Newly created FramebufferLayout object with mobile portrait screen regions initialized * @return Newly created FramebufferLayout object with mobile portrait screen regions initialized
*/ */
FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool is_swapped); FramebufferLayout PortraitTopFullFrameLayout(u32 width, u32 height, bool is_swapped,
bool upright = false);
/** /**
* Factory method for constructing a FramebufferLayout with only the top or bottom screen * Factory method for constructing a FramebufferLayout with only the top or bottom screen