1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Show "automatic" resolved renderer inline in dropdown instead

This commit is contained in:
Dean Herbert 2023-03-26 20:29:30 +09:00
parent 764361b3d3
commit ba078e8357
2 changed files with 29 additions and 9 deletions

View File

@ -24,11 +24,6 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString Renderer => new TranslatableString(getKey(@"renderer"), @"Renderer");
/// <summary>
/// "Current renderer is &quot;{0}&quot;"
/// </summary>
public static LocalisableString CurrentRenderer(string arg0) => new TranslatableString(getKey(@"current_renderer"), @"Current renderer is ""{0}""", arg0);
/// <summary>
/// "Frame limiter"
/// </summary>

View File

@ -5,11 +5,11 @@ using System.Linq;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
Children = new Drawable[]
{
rendererDropdown = new SettingsEnumDropdown<RendererType>
rendererDropdown = new RendererSettingsDropdown
{
LabelText = GraphicsSettingsStrings.Renderer,
Current = renderer,
@ -78,8 +78,33 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
rendererDropdown.Items = new[] { RendererType.Automatic, RendererType.OpenGLLegacy };
rendererDropdown.SetNoticeText("New renderer support for android is coming soon!", true);
}
else if (renderer.Value == RendererType.Automatic)
rendererDropdown.SetNoticeText(GraphicsSettingsStrings.CurrentRenderer(host.ResolvedRenderer.GetDescription()));
}
private partial class RendererSettingsDropdown : SettingsEnumDropdown<RendererType>
{
protected override OsuDropdown<RendererType> CreateDropdown() => new RendererDropdown();
protected partial class RendererDropdown : DropdownControl
{
private RendererType hostResolvedRenderer;
private bool automaticRendererInUse;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, GameHost host)
{
var renderer = config.GetBindable<RendererType>(FrameworkSetting.Renderer);
automaticRendererInUse = renderer.Value == RendererType.Automatic;
hostResolvedRenderer = host.ResolvedRenderer;
}
protected override LocalisableString GenerateItemText(RendererType item)
{
if (item == RendererType.Automatic && automaticRendererInUse)
return $"{base.GenerateItemText(item)} ({hostResolvedRenderer})";
return base.GenerateItemText(item);
}
}
}
}
}