Implement screen gap setting (#622)

* implement screen gap

* type conversion fix for windows

* int setting
This commit is contained in:
David Griswold
2025-04-16 15:05:46 -03:00
committed by AzaharPlus
parent 9658e6fbb1
commit 7a47b3d4ff
11 changed files with 90 additions and 18 deletions

View File

@@ -33,6 +33,7 @@ enum class IntSetting(
LANDSCAPE_BOTTOM_Y("custom_bottom_y",Settings.SECTION_LAYOUT,480),
LANDSCAPE_BOTTOM_WIDTH("custom_bottom_width",Settings.SECTION_LAYOUT,640),
LANDSCAPE_BOTTOM_HEIGHT("custom_bottom_height",Settings.SECTION_LAYOUT,480),
SCREEN_GAP("screen_gap",Settings.SECTION_LAYOUT,0),
PORTRAIT_SCREEN_LAYOUT("portrait_layout_option",Settings.SECTION_LAYOUT,0),
PORTRAIT_TOP_X("custom_portrait_top_x",Settings.SECTION_LAYOUT,0),
PORTRAIT_TOP_Y("custom_portrait_top_y",Settings.SECTION_LAYOUT,0),

View File

@@ -1092,6 +1092,18 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
IntSetting.SMALL_SCREEN_POSITION.defaultValue
)
)
add(
SliderSetting(
IntSetting.SCREEN_GAP,
R.string.screen_gap,
R.string.screen_gap_description,
0,
480,
"px",
IntSetting.SCREEN_GAP.key,
IntSetting.SCREEN_GAP.defaultValue.toFloat()
)
)
add(
SliderSetting(
FloatSetting.LARGE_SCREEN_PROPORTION,

View File

@@ -183,11 +183,13 @@ void Config::ReadValues() {
layoutInt = static_cast<int>(Settings::LayoutOption::LargeScreen);
}
Settings::values.layout_option = static_cast<Settings::LayoutOption>(layoutInt);
Settings::values.screen_gap = static_cast<int>(sdl2_config->GetReal("Layout", "screen_gap", 0));
Settings::values.large_screen_proportion =
static_cast<float>(sdl2_config->GetReal("Layout", "large_screen_proportion", 2.25));
Settings::values.small_screen_position = static_cast<Settings::SmallScreenPosition>(
sdl2_config->GetInteger("Layout", "small_screen_position",
static_cast<int>(Settings::SmallScreenPosition::TopRight)));
ReadSetting("Layout", Settings::values.screen_gap);
ReadSetting("Layout", Settings::values.custom_top_x);
ReadSetting("Layout", Settings::values.custom_top_y);
ReadSetting("Layout", Settings::values.custom_top_width);

View File

@@ -202,6 +202,12 @@ disable_right_eye_render =
# 5: Custom Layout
layout_option =
# Screen Gap - adds a gap between screens in all two-screen modes
# Measured in pixels relative to the 240px default height of the screens
# Scales with the larger screen (so 24 is 10% of the larger screen height)
# Default value is 0.0
screen_gap =
# Large Screen Proportion - Relative size of large:small in large screen mode
# Default value is 2.25
large_screen_proportion =

View File

@@ -428,6 +428,8 @@
<string name="small_screen_position_bottom_left">Bottom Left</string>
<string name="small_screen_position_above">Above</string>
<string name="small_screen_position_below">Below</string>
<string name="screen_gap">Screen Gap</string>
<string name="screen_gap_description">Gap between screens in all two-screen modes. Measured in px relative to the 240px height of the larger screen.</string>
<string name="large_screen_proportion">Large Screen Proportion</string>
<string name="large_screen_proportion_description">How many times larger is the large screen than the small screen in Large Screen layout?</string>
<string name="emulation_adjust_custom_layout">Adjust Custom Layout in Settings</string>