mirror of
https://github.com/osukey/osukey.git
synced 2025-05-28 08:57:25 +09:00
Add ability to select which display the game runs on
This commit is contained in:
parent
09a74cdfc6
commit
c06703d662
@ -54,6 +54,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString Resolution => new TranslatableString(getKey(@"resolution"), @"Resolution");
|
||||
|
||||
/// <summary>
|
||||
/// "Display"
|
||||
/// </summary>
|
||||
public static LocalisableString Display => new TranslatableString(getKey(@"display"), @"Display");
|
||||
|
||||
/// <summary>
|
||||
/// "UI scaling"
|
||||
/// </summary>
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
private FillFlowContainer<SettingsSlider<float>> scalingSettings;
|
||||
|
||||
private readonly IBindable<Display> currentDisplay = new Bindable<Display>();
|
||||
private readonly Bindable<Display> currentDisplay = new Bindable<Display>();
|
||||
private readonly IBindableList<WindowMode> windowModes = new BindableList<WindowMode>();
|
||||
|
||||
private Bindable<ScalingMode> scalingMode;
|
||||
@ -39,6 +39,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
private OsuGameBase game { get; set; }
|
||||
|
||||
private SettingsDropdown<Size> resolutionDropdown;
|
||||
private SettingsDropdown<Display> displayDropdown;
|
||||
private SettingsDropdown<WindowMode> windowModeDropdown;
|
||||
|
||||
private Bindable<float> scalingPositionX;
|
||||
@ -72,6 +73,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
ItemSource = windowModes,
|
||||
Current = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||
},
|
||||
displayDropdown = new DisplaySettingsDropdown
|
||||
{
|
||||
LabelText = GraphicsSettingsStrings.Display,
|
||||
Items = host.Window?.Displays,
|
||||
Current = currentDisplay,
|
||||
},
|
||||
resolutionDropdown = new ResolutionSettingsDropdown
|
||||
{
|
||||
LabelText = GraphicsSettingsStrings.Resolution,
|
||||
@ -142,7 +149,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
windowModeDropdown.Current.BindValueChanged(mode =>
|
||||
{
|
||||
updateResolutionDropdown();
|
||||
updateFullscreenDropdowns();
|
||||
|
||||
windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? GraphicsSettingsStrings.NotFullscreenNote : default;
|
||||
}, true);
|
||||
@ -168,7 +175,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
.Distinct());
|
||||
}
|
||||
|
||||
updateResolutionDropdown();
|
||||
updateFullscreenDropdowns();
|
||||
}), true);
|
||||
|
||||
scalingMode.BindValueChanged(mode =>
|
||||
@ -183,12 +190,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
// initial update bypasses transforms
|
||||
updateScalingModeVisibility();
|
||||
|
||||
void updateResolutionDropdown()
|
||||
void updateFullscreenDropdowns()
|
||||
{
|
||||
if (resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen)
|
||||
resolutionDropdown.Show();
|
||||
else
|
||||
resolutionDropdown.Hide();
|
||||
|
||||
if (displayDropdown.Items.Count() > 1)
|
||||
displayDropdown.Show();
|
||||
else
|
||||
displayDropdown.Hide();
|
||||
}
|
||||
|
||||
void updateScalingModeVisibility()
|
||||
@ -243,6 +255,19 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
public override LocalisableString TooltipText => base.TooltipText + "x";
|
||||
}
|
||||
|
||||
private class DisplaySettingsDropdown : SettingsDropdown<Display>
|
||||
{
|
||||
protected override OsuDropdown<Display> CreateDropdown() => new DisplaySettingsDropdownControl();
|
||||
|
||||
private class DisplaySettingsDropdownControl : DropdownControl
|
||||
{
|
||||
protected override LocalisableString GenerateItemText(Display item)
|
||||
{
|
||||
return $"{item.Index}: {item.Name} ({item.Bounds.Width}x{item.Bounds.Height})";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
||||
{
|
||||
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl();
|
||||
|
Loading…
x
Reference in New Issue
Block a user