diff --git a/osu.Game/Localisation/GraphicsSettingsStrings.cs b/osu.Game/Localisation/GraphicsSettingsStrings.cs
index 6e05929d81..422704514f 100644
--- a/osu.Game/Localisation/GraphicsSettingsStrings.cs
+++ b/osu.Game/Localisation/GraphicsSettingsStrings.cs
@@ -19,6 +19,11 @@ public static class GraphicsSettingsStrings
///
public static LocalisableString RendererHeader => new TranslatableString(getKey(@"renderer_header"), @"Renderer");
+ ///
+ /// "Renderer"
+ ///
+ public static LocalisableString Renderer => new TranslatableString(getKey(@"renderer"), @"Renderer");
+
///
/// "Frame limiter"
///
@@ -144,6 +149,12 @@ public static class GraphicsSettingsStrings
///
public static LocalisableString Png => new TranslatableString(getKey(@"png_lossless"), @"PNG (lossless)");
+ ///
+ /// "In order to change the renderer, the game will close. Please open it again."
+ ///
+ public static LocalisableString ChangeRendererConfirmation =>
+ new TranslatableString(getKey(@"change_renderer_configuration"), @"In order to change the renderer, the game will close. Please open it again.");
+
private static string getKey(string key) => $"{prefix}:{key}";
}
}
diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs
index 08a62ff324..ba2691e41c 100644
--- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs
@@ -2,13 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
-using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Localisation;
+using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Settings.Sections.Graphics
{
@@ -17,15 +17,16 @@ public partial class RendererSettings : SettingsSubsection
protected override LocalisableString Header => GraphicsSettingsStrings.RendererHeader;
[BackgroundDependencyLoader]
- private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
+ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, IDialogOverlay dialogOverlay, OsuGame game, GameHost host)
{
- // NOTE: Compatability mode omitted
+ var renderer = config.GetBindable(FrameworkSetting.Renderer);
+
Children = new Drawable[]
{
new SettingsEnumDropdown
{
LabelText = GraphicsSettingsStrings.Renderer,
- Current = config.GetBindable(FrameworkSetting.Renderer),
+ Current = renderer,
Keywords = new[] { @"compatibility", @"directx" },
},
// TODO: this needs to be a custom dropdown at some point
@@ -46,6 +47,17 @@ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
Current = osuConfig.GetBindable(OsuSetting.ShowFpsDisplay)
},
};
+
+ renderer.BindValueChanged(r =>
+ {
+ if (r.NewValue == host.ResolvedRenderer)
+ return;
+
+ dialogOverlay.Push(new ConfirmDialog(GraphicsSettingsStrings.ChangeRendererConfirmation, game.AttemptExit, () =>
+ {
+ renderer.SetDefault();
+ }));
+ });
}
}
}