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:
parent
764361b3d3
commit
ba078e8357
@ -24,11 +24,6 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString Renderer => new TranslatableString(getKey(@"renderer"), @"Renderer");
|
||||
|
||||
/// <summary>
|
||||
/// "Current renderer is "{0}""
|
||||
/// </summary>
|
||||
public static LocalisableString CurrentRenderer(string arg0) => new TranslatableString(getKey(@"current_renderer"), @"Current renderer is ""{0}""", arg0);
|
||||
|
||||
/// <summary>
|
||||
/// "Frame limiter"
|
||||
/// </summary>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user