From f7806bc20538111cf2fc858d979dcc808a655e3e Mon Sep 17 00:00:00 2001 From: HoLLy Date: Mon, 13 May 2019 01:31:47 +0200 Subject: [PATCH 1/6] Add smoothing to flashlight movement --- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index c0332fbf60..c3c1e86c18 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -7,6 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Framework.MathUtils; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; @@ -35,6 +36,9 @@ namespace osu.Game.Rulesets.Osu.Mods private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition { + private const double follow_delay = 120; + private double lastPositionUpdate; + public OsuFlashlight() { FlashlightSize = new Vector2(0, getSizeFor(0)); @@ -48,7 +52,16 @@ namespace osu.Game.Rulesets.Osu.Mods protected override bool OnMouseMove(MouseMoveEvent e) { - FlashlightPosition = e.MousePosition; + var position = FlashlightPosition; + var destination = e.MousePosition; + + double frameTime = Clock.CurrentTime - lastPositionUpdate; + double interp = Interpolation.ApplyEasing(Easing.Out, MathHelper.Clamp(frameTime / follow_delay, 0, 1)); + FlashlightPosition = new Vector2( + (float)Interpolation.Lerp(position.X, destination.X, interp), + (float)Interpolation.Lerp(position.Y, destination.Y, interp) + ); + lastPositionUpdate = Clock.CurrentTime; return base.OnMouseMove(e); } From 4b8a9bae346b5c40a98cf767b51632c855dcdcd9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 17:17:20 +0900 Subject: [PATCH 2/6] Remove unused test case --- osu.Game.Tests/Visual/TestCaseCharLookup.cs | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 osu.Game.Tests/Visual/TestCaseCharLookup.cs diff --git a/osu.Game.Tests/Visual/TestCaseCharLookup.cs b/osu.Game.Tests/Visual/TestCaseCharLookup.cs deleted file mode 100644 index 0b9413f332..0000000000 --- a/osu.Game.Tests/Visual/TestCaseCharLookup.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Graphics.Sprites; - -namespace osu.Game.Tests.Visual -{ - public class TestCaseCharLookup : OsuTestCase - { - public TestCaseCharLookup() - { - AddStep("null", () => { }); - AddStep("display acharacter", () => Add(new OsuSpriteText { Text = "振込申請" })); - } - } -} From 1809c996bbede491ce99aea838122e589f770c3e Mon Sep 17 00:00:00 2001 From: HoLLy Date: Mon, 13 May 2019 12:09:19 +0200 Subject: [PATCH 3/6] Use Interpolation.ValueAt instead of manually interpolating FL position. --- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index c3c1e86c18..084959f775 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -37,7 +37,6 @@ namespace osu.Game.Rulesets.Osu.Mods private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition { private const double follow_delay = 120; - private double lastPositionUpdate; public OsuFlashlight() { @@ -55,13 +54,8 @@ namespace osu.Game.Rulesets.Osu.Mods var position = FlashlightPosition; var destination = e.MousePosition; - double frameTime = Clock.CurrentTime - lastPositionUpdate; - double interp = Interpolation.ApplyEasing(Easing.Out, MathHelper.Clamp(frameTime / follow_delay, 0, 1)); - FlashlightPosition = new Vector2( - (float)Interpolation.Lerp(position.X, destination.X, interp), - (float)Interpolation.Lerp(position.Y, destination.Y, interp) - ); - lastPositionUpdate = Clock.CurrentTime; + FlashlightPosition = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, follow_delay), position, destination, 0, follow_delay, Easing.Out); + return base.OnMouseMove(e); } From d18504bfe0b82e622f0eb6bcc0d8f013eefb0246 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 13 May 2019 19:23:38 +0900 Subject: [PATCH 4/6] Attempt to fix pause test failures by reducing steps --- osu.Game.Tests/Visual/Gameplay/TestCasePause.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index 53ac990183..1a6d58909d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -86,8 +86,8 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10))); pauseAndConfirm(); - resumeAndConfirm(); + resume(); pause(); confirmClockRunning(true); From 647e2c297cb91288df121bf4577a792537ce4012 Mon Sep 17 00:00:00 2001 From: Xie Yi Date: Tue, 14 May 2019 02:45:12 +0800 Subject: [PATCH 5/6] Fix iOS app entry for raw keyboard input --- osu.iOS/Application.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS/Application.cs b/osu.iOS/Application.cs index cb75e5c159..30e0e15ad1 100644 --- a/osu.iOS/Application.cs +++ b/osu.iOS/Application.cs @@ -9,7 +9,7 @@ namespace osu.iOS { public static void Main(string[] args) { - UIApplication.Main(args, null, "AppDelegate"); + UIApplication.Main(args, "GameUIApplication", "AppDelegate"); } } } From be6da833f822ab60ecbdd9c8f8acb7b54812aa6c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 14 May 2019 11:11:57 +0900 Subject: [PATCH 6/6] Move constant local (and break line) --- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index 084959f775..7fa3dbe07e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -36,8 +36,6 @@ namespace osu.Game.Rulesets.Osu.Mods private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition { - private const double follow_delay = 120; - public OsuFlashlight() { FlashlightSize = new Vector2(0, getSizeFor(0)); @@ -51,10 +49,13 @@ namespace osu.Game.Rulesets.Osu.Mods protected override bool OnMouseMove(MouseMoveEvent e) { + const double follow_delay = 120; + var position = FlashlightPosition; var destination = e.MousePosition; - FlashlightPosition = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, follow_delay), position, destination, 0, follow_delay, Easing.Out); + FlashlightPosition = Interpolation.ValueAt( + MathHelper.Clamp(Clock.ElapsedFrameTime, 0, follow_delay), position, destination, 0, follow_delay, Easing.Out); return base.OnMouseMove(e); }