From c860eb25f9101efe4a3bdbe6bbb635c489004779 Mon Sep 17 00:00:00 2001 From: Tom94 Date: Mon, 14 Nov 2016 17:22:20 +0100 Subject: [PATCH] Migrate to new anchor system without x/y reversal. --- osu-framework | 2 +- .../Tests/TestCaseScoreCounter.cs | 13 +++++++------ osu.Game/GameModes/Play/Osu/OsuComboCounter.cs | 7 ++++--- osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs | 3 ++- .../UserInterface/Volume/VolumeControl.cs | 3 ++- osu.Game/Overlays/MusicController.cs | 17 +++++++++-------- osu.Game/Overlays/ToolbarButton.cs | 2 +- 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/osu-framework b/osu-framework index 87a5cd4ce4..cf7dd12f24 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 87a5cd4ce48d6370b8e392378289825f4b4a2039 +Subproject commit cf7dd12f24d0b60bae2a4ebaa6ef0eaa67b0fd52 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index eb5f51d883..9cb501a640 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -14,6 +14,7 @@ using osu.Game.GameModes.Play.Taiko; using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Graphics.Primitives; namespace osu.Desktop.VisualTests.Tests { @@ -37,7 +38,7 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.TopRight, TextSize = 40, Count = 0, - Position = new Vector2(20, 20), + Margin = new MarginPadding(20), }; Add(score); @@ -45,8 +46,8 @@ namespace osu.Desktop.VisualTests.Tests { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Position = new Vector2(10, 10), - InnerCountPosition = new Vector2(10, 10), + Margin = new MarginPadding(10), + InnerCountMargin = new MarginPadding(10), Count = 0, TextSize = 40, }; @@ -86,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, - Position = new Vector2(20, 60), + Position = new Vector2(-20, 60), }; Add(accuracyCombo); @@ -94,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Position = new Vector2(20, 160), + Position = new Vector2(20, -160), Count = 5, }; Add(stars); @@ -103,7 +104,7 @@ namespace osu.Desktop.VisualTests.Tests { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Position = new Vector2(20, 190), + Position = new Vector2(20, -190), Text = stars.Count.ToString("0.00"), }; Add(starsLabel); diff --git a/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs b/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs index 5fdc4fcc5e..78a8d4bc99 100644 --- a/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs +++ b/osu.Game/GameModes/Play/Osu/OsuComboCounter.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Graphics.Primitives; namespace osu.Game.GameModes.Play.Osu { @@ -22,15 +23,15 @@ namespace osu.Game.GameModes.Play.Osu protected virtual float PopOutSmallScale => 1.1f; protected virtual bool CanPopOutWhileRolling => false; - public Vector2 InnerCountPosition + public MarginPadding InnerCountMargin { get { - return DisplayedCountSpriteText.Position; + return DisplayedCountSpriteText.Margin; } set { - DisplayedCountSpriteText.Position = value; + DisplayedCountSpriteText.Margin = value; } } diff --git a/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs b/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs index 1622379fe8..4c751cb4ee 100644 --- a/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs +++ b/osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs @@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Input; using osu.Game.Beatmaps.Objects; +using osu.Framework.Graphics.Primitives; namespace osu.Game.GameModes.Play.Osu { @@ -42,7 +43,7 @@ namespace osu.Game.GameModes.Play.Osu FadeTime = 50, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, - Position = new Vector2(10), + Margin = new MarginPadding(10), Counters = new KeyCounter[] { new KeyCounterKeyboard(@"Z", Key.Z), diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 6163ba3aad..6c0315b9f1 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -7,6 +7,7 @@ using osu.Framework.Input; using osu.Framework.Threading; using OpenTK; using osu.Framework.Allocation; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Graphics.UserInterface.Volume { @@ -40,7 +41,7 @@ namespace osu.Game.Graphics.UserInterface.Volume AutoSizeAxes = Axes.Both, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, - Position = new Vector2(10, 30), + Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 }, Spacing = new Vector2(15, 0), }); } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 2ae9b74d8f..1be929ab88 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -22,12 +22,13 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Overlays { public class MusicController : OverlayContainer { - private static readonly Vector2 start_position = new Vector2(10, 60); + private static readonly Vector2 start_position = new Vector2(0, 50); private MusicControllerBackground backgroundSprite; private DragBar progress; @@ -63,6 +64,8 @@ namespace osu.Game.Overlays Anchor = Anchor.TopRight;//placeholder Origin = Anchor.TopRight; Position = start_position; + Margin = new MarginPadding(10); + Children = new Drawable[] { title = new SpriteText @@ -90,7 +93,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.BottomCentre, - Position = new Vector2(0, 30), + Position = new Vector2(0, -30), Action = () => { if (current?.Track == null) return; @@ -115,7 +118,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.BottomCentre, - Position = new Vector2(-30, 30), + Position = new Vector2(-30, -30), Action = prev, Children = new Drawable[] { @@ -133,7 +136,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.BottomCentre, - Position = new Vector2(30, 30), + Position = new Vector2(30, -30), Action = next, Children = new Drawable[] { @@ -151,7 +154,7 @@ namespace osu.Game.Overlays AutoSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.BottomRight, - Position = new Vector2(20, 30), + Position = new Vector2(20, -30), Children = new Drawable[] { listButton = new TextAwesome @@ -180,9 +183,7 @@ namespace osu.Game.Overlays { Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value); - if ((Anchor & Anchor.x2) > 0) - change.X = -change.X; - + // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= (float)Math.Pow(change.Length, 0.7f) / change.Length; MoveTo(start_position + change); diff --git a/osu.Game/Overlays/ToolbarButton.cs b/osu.Game/Overlays/ToolbarButton.cs index 8fa5ff10b7..9779af9e0a 100644 --- a/osu.Game/Overlays/ToolbarButton.cs +++ b/osu.Game/Overlays/ToolbarButton.cs @@ -98,7 +98,7 @@ namespace osu.Game.Overlays Direction = FlowDirection.VerticalOnly, AutoSizeAxes = Axes.Both, Anchor = Anchor.BottomLeft, - Position = new Vector2(5, -5), + Position = new Vector2(5, 5), Alpha = 0, Children = new[] {