diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 381bca2a71..1562571efc 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -31,6 +31,7 @@ protected override void InitialiseDefaults() Set(OsuConfig.SnakingInSliders, true); Set(OsuConfig.SnakingOutSliders, false); + Set(OsuConfig.MenuParallax, true); //todo: implement all settings below this line (remove the Disabled set when doing so). Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; @@ -143,7 +144,6 @@ protected override void InitialiseDefaults() Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true; Set(OsuConfig.MenuMusic, true).Disabled = true; Set(OsuConfig.MenuVoice, true).Disabled = true; - Set(OsuConfig.MenuParallax, true).Disabled = true; Set(OsuConfig.RawInput, false).Disabled = true; Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)).Disabled = true; Set(OsuConfig.ShowMenuTips, true).Disabled = true; diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index fe3601a5f2..7513961574 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -8,12 +8,26 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics.Transformations; +using osu.Game.Configuration; namespace osu.Game.Graphics.Containers { class ParallaxContainer : Container { - public float ParallaxAmount = 0.02f; + public float ParallaxAmount + { + get + { + return defaultParallaxAmount; + } + + set + { + defaultParallaxAmount = value; + } + } + private float parallaxAmount; + private float defaultParallaxAmount = 0.02f; public override bool Contains(Vector2 screenSpacePos) => true; @@ -34,9 +48,15 @@ public ParallaxContainer() protected override Container Content => content; [BackgroundDependencyLoader] - private void load(UserInputManager input) + private void load(UserInputManager input, OsuConfigManager config) { this.input = input; + + config.GetBindable(OsuConfig.MenuParallax).ValueChanged += delegate + { + parallaxAmount = config.GetBindable(OsuConfig.MenuParallax) ? defaultParallaxAmount : 0; + }; + parallaxAmount = config.GetBindable(OsuConfig.MenuParallax) ? defaultParallaxAmount : 0; } bool firstUpdate = true; @@ -46,8 +66,8 @@ protected override void Update() base.Update(); Vector2 offset = input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2; - content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); - content.Scale = new Vector2(1 + ParallaxAmount); + content.MoveTo(offset * parallaxAmount, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); + content.Scale = new Vector2(1 + parallaxAmount); firstUpdate = false; } diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 29fc44d673..1a6310ea4e 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -59,7 +59,6 @@ private void load(OsuGame game) background.Preload(game); buttons.OnSettings = game.ToggleOptions; - } protected override void OnEntering(Screen last)