mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 09:37:23 +08:00
Merge pull request #17047 from peppy/add-display-choice-dropdown
Add ability to select which display the game runs on
This commit is contained in:
commit
cdd7e0b741
@ -52,7 +52,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.304.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.304.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.223.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.304.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||||
|
@ -54,6 +54,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString Resolution => new TranslatableString(getKey(@"resolution"), @"Resolution");
|
public static LocalisableString Resolution => new TranslatableString(getKey(@"resolution"), @"Resolution");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Display"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString Display => new TranslatableString(getKey(@"display"), @"Display");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "UI scaling"
|
/// "UI scaling"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
private FillFlowContainer<SettingsSlider<float>> scalingSettings;
|
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 readonly IBindableList<WindowMode> windowModes = new BindableList<WindowMode>();
|
||||||
|
|
||||||
private Bindable<ScalingMode> scalingMode;
|
private Bindable<ScalingMode> scalingMode;
|
||||||
@ -39,6 +39,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
private OsuGameBase game { get; set; }
|
private OsuGameBase game { get; set; }
|
||||||
|
|
||||||
private SettingsDropdown<Size> resolutionDropdown;
|
private SettingsDropdown<Size> resolutionDropdown;
|
||||||
|
private SettingsDropdown<Display> displayDropdown;
|
||||||
private SettingsDropdown<WindowMode> windowModeDropdown;
|
private SettingsDropdown<WindowMode> windowModeDropdown;
|
||||||
|
|
||||||
private Bindable<float> scalingPositionX;
|
private Bindable<float> scalingPositionX;
|
||||||
@ -72,6 +73,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
ItemSource = windowModes,
|
ItemSource = windowModes,
|
||||||
Current = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
Current = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||||
},
|
},
|
||||||
|
displayDropdown = new DisplaySettingsDropdown
|
||||||
|
{
|
||||||
|
LabelText = GraphicsSettingsStrings.Display,
|
||||||
|
Items = host.Window?.Displays,
|
||||||
|
Current = currentDisplay,
|
||||||
|
},
|
||||||
resolutionDropdown = new ResolutionSettingsDropdown
|
resolutionDropdown = new ResolutionSettingsDropdown
|
||||||
{
|
{
|
||||||
LabelText = GraphicsSettingsStrings.Resolution,
|
LabelText = GraphicsSettingsStrings.Resolution,
|
||||||
@ -142,7 +149,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
windowModeDropdown.Current.BindValueChanged(mode =>
|
windowModeDropdown.Current.BindValueChanged(mode =>
|
||||||
{
|
{
|
||||||
updateResolutionDropdown();
|
updateDisplayModeDropdowns();
|
||||||
|
|
||||||
windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? GraphicsSettingsStrings.NotFullscreenNote : default;
|
windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? GraphicsSettingsStrings.NotFullscreenNote : default;
|
||||||
}, true);
|
}, true);
|
||||||
@ -168,7 +175,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
.Distinct());
|
.Distinct());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResolutionDropdown();
|
updateDisplayModeDropdowns();
|
||||||
}), true);
|
}), true);
|
||||||
|
|
||||||
scalingMode.BindValueChanged(mode =>
|
scalingMode.BindValueChanged(mode =>
|
||||||
@ -183,12 +190,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
// initial update bypasses transforms
|
// initial update bypasses transforms
|
||||||
updateScalingModeVisibility();
|
updateScalingModeVisibility();
|
||||||
|
|
||||||
void updateResolutionDropdown()
|
void updateDisplayModeDropdowns()
|
||||||
{
|
{
|
||||||
if (resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen)
|
if (resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen)
|
||||||
resolutionDropdown.Show();
|
resolutionDropdown.Show();
|
||||||
else
|
else
|
||||||
resolutionDropdown.Hide();
|
resolutionDropdown.Hide();
|
||||||
|
|
||||||
|
if (displayDropdown.Items.Count() > 1)
|
||||||
|
displayDropdown.Show();
|
||||||
|
else
|
||||||
|
displayDropdown.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateScalingModeVisibility()
|
void updateScalingModeVisibility()
|
||||||
@ -243,6 +255,19 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
public override LocalisableString TooltipText => base.TooltipText + "x";
|
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>
|
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
||||||
{
|
{
|
||||||
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl();
|
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="10.9.0" />
|
<PackageReference Include="Realm" Version="10.9.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2022.223.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2022.304.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.304.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.304.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.14.0" />
|
<PackageReference Include="Sentry" Version="3.14.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.30.1" />
|
<PackageReference Include="SharpCompress" Version="0.30.1" />
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.223.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.304.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.304.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.304.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2022.223.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2022.304.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.30.1" />
|
<PackageReference Include="SharpCompress" Version="0.30.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user