Refactored layout code in preparation for Android custom layout GUI

This commit is contained in:
David Griswold
2024-08-11 15:59:41 +01:00
committed by OpenSauce04
parent c78e893cd7
commit b293a253f5
29 changed files with 453 additions and 244 deletions

View File

@@ -109,6 +109,7 @@ void LogSettings() {
log_setting("Renderer_AnaglyphShader", values.anaglyph_shader_name.GetValue());
}
log_setting("Layout_LayoutOption", values.layout_option.GetValue());
log_setting("Layout_PortraitLayoutOption", values.portrait_layout_option.GetValue());
log_setting("Layout_SwapScreen", values.swap_screen.GetValue());
log_setting("Layout_UprightScreen", values.upright_screen.GetValue());
log_setting("Layout_LargeScreenProportion", values.large_screen_proportion.GetValue());
@@ -199,6 +200,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.texture_sampling.SetGlobal(true);
values.delay_game_render_thread_us.SetGlobal(true);
values.layout_option.SetGlobal(true);
values.portrait_layout_option.SetGlobal(true);
values.swap_screen.SetGlobal(true);
values.upright_screen.SetGlobal(true);
values.large_screen_proportion.SetGlobal(true);

View File

@@ -33,6 +33,7 @@ enum class InitTicks : u32 {
Fixed = 1,
};
/** Defines the layout option for desktop and mobile landscape */
enum class LayoutOption : u32 {
Default,
SingleScreen,
@@ -42,18 +43,20 @@ enum class LayoutOption : u32 {
SeparateWindows,
#endif
HybridScreen,
#ifndef ANDROID // TODO: Implement custom layouts on Android
CustomLayout,
#endif
// Similiar to default, but better for mobile devices in portrait mode. Top screen in clamped to
// the top of the frame, and the bottom screen is enlarged to match the top screen.
MobilePortrait,
// Similiar to LargeScreen, but better for mobile devices in landscape mode. The screens are
// clamped to the top of the frame, and the bottom screen is a bit bigger.
MobileLandscape,
};
/** Defines the layout option for mobile portrait */
enum class PortraitLayoutOption : u32 {
// formerly mobile portrait
PortraitTopFullWidth,
PortraitCustomLayout,
};
enum class StereoRenderOption : u32 {
Off = 0,
SideBySide = 1,
@@ -492,15 +495,17 @@ struct Values {
SwitchableSetting<bool> upright_screen{false, "upright_screen"};
SwitchableSetting<float, true> large_screen_proportion{4.f, 1.f, 16.f,
"large_screen_proportion"};
// I think the custom_layout setting below is no longer needed
// since custom layout is now just part of the layout option above?
Setting<bool> custom_layout{false, "custom_layout"};
Setting<u16> custom_top_x{0, "custom_top_x"};
Setting<u16> custom_top_y{0, "custom_top_y"};
Setting<u16> custom_top_width{400, "custom_top_width"};
Setting<u16> custom_top_height{240, "custom_top_height"};
Setting<u16> custom_bottom_x{40, "custom_bottom_x"};
Setting<u16> custom_bottom_y{240, "custom_bottom_y"};
Setting<u16> custom_bottom_width{320, "custom_bottom_width"};
Setting<u16> custom_bottom_height{240, "custom_bottom_height"};
Setting<u16> custom_top_width{800, "custom_top_width"};
Setting<u16> custom_top_height{480, "custom_top_height"};
Setting<u16> custom_bottom_x{80, "custom_bottom_x"};
Setting<u16> custom_bottom_y{500, "custom_bottom_y"};
Setting<u16> custom_bottom_width{640, "custom_bottom_width"};
Setting<u16> custom_bottom_height{480, "custom_bottom_height"};
Setting<u16> custom_second_layer_opacity{100, "custom_second_layer_opacity"};
SwitchableSetting<bool> screen_top_stretch{false, "screen_top_stretch"};
@@ -510,14 +515,15 @@ struct Values {
Setting<u16> screen_bottom_leftright_padding{0, "screen_bottom_leftright_padding"};
Setting<u16> screen_bottom_topbottom_padding{0, "screen_bottom_topbottom_padding"};
Setting<bool> custom_portrait_layout{false, "custom_portrait_layout"};
SwitchableSetting<PortraitLayoutOption> portrait_layout_option{
PortraitLayoutOption::PortraitTopFullWidth, "portrait_layout_option"};
Setting<u16> custom_portrait_top_x{0, "custom_portrait_top_x"};
Setting<u16> custom_portrait_top_y{0, "custom_portrait_top_y"};
Setting<u16> custom_portrait_top_width{400, "custom_portrait_top_width"};
Setting<u16> custom_portrait_top_height{240, "custom_portrait_top_height"};
Setting<u16> custom_portrait_bottom_x{40, "custom_portrait_bottom_x"};
Setting<u16> custom_portrait_bottom_y{240, "custom_portrait_bottom_y"};
Setting<u16> custom_portrait_bottom_width{360, "custom_portrait_bottom_width"};
Setting<u16> custom_portrait_top_width{800, "custom_portrait_top_width"};
Setting<u16> custom_portrait_top_height{480, "custom_portrait_top_height"};
Setting<u16> custom_portrait_bottom_x{80, "custom_portrait_bottom_x"};
Setting<u16> custom_portrait_bottom_y{500, "custom_portrait_bottom_y"};
Setting<u16> custom_portrait_bottom_width{640, "custom_portrait_bottom_width"};
Setting<u16> custom_portrait_bottom_height{480, "custom_portrait_bottom_height"};
SwitchableSetting<float> bg_red{0.f, "bg_red"};