From 489f58688799831916930fbd1c2463d872caa436 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 May 2017 20:34:53 +0900 Subject: [PATCH] Add FPS display toggling. Kinda temporary but better than nothing. --- osu.Game/Configuration/OsuConfigManager.cs | 5 ++++- osu.Game/OsuGameBase.cs | 12 ++++++++++++ .../Options/Sections/Graphics/RendererOptions.cs | 9 ++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2c9574905f..3907496ca2 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -53,6 +53,8 @@ namespace osu.Game.Configuration // Graphics + Set(OsuConfig.ShowFpsDisplay, false); + Set(OsuConfig.MenuParallax, true); Set(OsuConfig.SnakingInSliders, true); @@ -99,6 +101,7 @@ namespace osu.Game.Configuration DisplayStarsMinimum, DisplayStarsMaximum, SnakingInSliders, - SnakingOutSliders + SnakingOutSliders, + ShowFpsDisplay } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c9d7d856db..a814b5f125 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Processing; using osu.Game.Online.API; using SQLite.Net; +using osu.Framework.Graphics.Performance; namespace osu.Game { @@ -44,6 +45,8 @@ namespace osu.Game public readonly Bindable Beatmap = new Bindable(); + private Bindable fpsDisplayVisible; + protected AssemblyName AssemblyName => Assembly.GetEntryAssembly()?.GetName() ?? new AssemblyName { Version = new Version() }; public bool IsDeployedBuild => AssemblyName.Version.Major > 0; @@ -160,6 +163,15 @@ namespace osu.Game }, } }); + + // TODO: This is temporary until we reimplement the local FPS display. + // It's just to allow end-users to access the framework FPS display without knowing the shortcut key. + fpsDisplayVisible = LocalConfig.GetBindable(OsuConfig.ShowFpsDisplay); + fpsDisplayVisible.ValueChanged += val => + { + FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; + }; + fpsDisplayVisible.TriggerChange(); } public override void SetHost(GameHost host) diff --git a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs index fafe91cfc5..58bf2b7996 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/RendererOptions.cs @@ -4,6 +4,8 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Graphics { @@ -12,7 +14,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics protected override string Header => "Renderer"; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config) + private void load(FrameworkConfigManager config, OsuConfigManager osuConfig) { // NOTE: Compatability mode omitted Children = new Drawable[] @@ -23,6 +25,11 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Frame limiter", Bindable = config.GetBindable(FrameworkConfig.FrameSync) }, + new OsuCheckbox + { + LabelText = "Show FPS", + Bindable = osuConfig.GetBindable(OsuConfig.ShowFpsDisplay) + }, }; } }