From 7751a85e141eeb92a78780adf03b039fa8e84cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Oct 2016 14:10:06 +0200 Subject: [PATCH 1/3] Update framework. --- osu-framework | 2 +- osu.Game/GameModes/GameModeWhiteBox.cs | 1 - osu.Game/GameModes/Menu/Button.cs | 1 - osu.Game/GameModes/Menu/ButtonSystem.cs | 3 --- osu.Game/GameModes/Play/Catch/CatchPlayfield.cs | 1 - osu.Game/GameModes/Play/Mania/ManiaPlayfield.cs | 1 - osu.Game/GameModes/Play/Osu/OsuPlayfield.cs | 2 +- osu.Game/GameModes/Play/Taiko/TaikoPlayfield.cs | 1 - osu.Game/Online/Chat/Display/ChatLine.cs | 1 - osu.Game/Overlays/ChatConsole.cs | 1 - osu.Game/Overlays/Options.cs | 2 +- osu.Game/Overlays/Toolbar.cs | 2 +- osu.Game/Overlays/ToolbarButton.cs | 1 - osu.Game/Overlays/ToolbarModeSelector.cs | 2 +- osu.Game/VolumeMeter.cs | 1 - 15 files changed, 5 insertions(+), 17 deletions(-) diff --git a/osu-framework b/osu-framework index cb420e7f7f..27e2bbc71a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cb420e7f7f4ef9cdda8ae8336d997946384d3732 +Subproject commit 27e2bbc71a9e97e538c0d6018ea81a08bd24105e diff --git a/osu.Game/GameModes/GameModeWhiteBox.cs b/osu.Game/GameModes/GameModeWhiteBox.cs index 121cb20d12..9c404e7241 100644 --- a/osu.Game/GameModes/GameModeWhiteBox.cs +++ b/osu.Game/GameModes/GameModeWhiteBox.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using osu.Framework.GameModes; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/GameModes/Menu/Button.cs b/osu.Game/GameModes/Menu/Button.cs index 261af9e78b..46fc627483 100644 --- a/osu.Game/GameModes/Menu/Button.cs +++ b/osu.Game/GameModes/Menu/Button.cs @@ -4,7 +4,6 @@ using OpenTK.Input; using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; diff --git a/osu.Game/GameModes/Menu/ButtonSystem.cs b/osu.Game/GameModes/Menu/ButtonSystem.cs index b4911928a4..2f1d84b3ab 100644 --- a/osu.Game/GameModes/Menu/ButtonSystem.cs +++ b/osu.Game/GameModes/Menu/ButtonSystem.cs @@ -6,13 +6,10 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; -using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; diff --git a/osu.Game/GameModes/Play/Catch/CatchPlayfield.cs b/osu.Game/GameModes/Play/Catch/CatchPlayfield.cs index fef80e6b4a..a9c781c138 100644 --- a/osu.Game/GameModes/Play/Catch/CatchPlayfield.cs +++ b/osu.Game/GameModes/Play/Catch/CatchPlayfield.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/GameModes/Play/Mania/ManiaPlayfield.cs b/osu.Game/GameModes/Play/Mania/ManiaPlayfield.cs index 53de8221eb..ed21c52e81 100644 --- a/osu.Game/GameModes/Play/Mania/ManiaPlayfield.cs +++ b/osu.Game/GameModes/Play/Mania/ManiaPlayfield.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs b/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs index e232a2af40..b18666cef3 100644 --- a/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs +++ b/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs @@ -3,9 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using OpenTK; using osu.Framework; +using osu.Framework.Graphics.Sprites; namespace osu.Game.GameModes.Play.Osu { diff --git a/osu.Game/GameModes/Play/Taiko/TaikoPlayfield.cs b/osu.Game/GameModes/Play/Taiko/TaikoPlayfield.cs index 0f2ab70727..18e22ffd02 100644 --- a/osu.Game/GameModes/Play/Taiko/TaikoPlayfield.cs +++ b/osu.Game/GameModes/Play/Taiko/TaikoPlayfield.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Online/Chat/Display/ChatLine.cs b/osu.Game/Online/Chat/Display/ChatLine.cs index 92146be0b2..3f1152064e 100644 --- a/osu.Game/Online/Chat/Display/ChatLine.cs +++ b/osu.Game/Online/Chat/Display/ChatLine.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/ChatConsole.cs b/osu.Game/Overlays/ChatConsole.cs index 820b9245d3..49e4f7f686 100644 --- a/osu.Game/Overlays/ChatConsole.cs +++ b/osu.Game/Overlays/ChatConsole.cs @@ -9,7 +9,6 @@ using OpenTK.Graphics; using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Threading; diff --git a/osu.Game/Overlays/Options.cs b/osu.Game/Overlays/Options.cs index 5bcc5e9a16..6713bef3a2 100644 --- a/osu.Game/Overlays/Options.cs +++ b/osu.Game/Overlays/Options.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Drawables; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; diff --git a/osu.Game/Overlays/Toolbar.cs b/osu.Game/Overlays/Toolbar.cs index c4bc9518cc..14a295efe8 100644 --- a/osu.Game/Overlays/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar.cs @@ -7,11 +7,11 @@ using OpenTK.Graphics; using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Transformations; using osu.Game.Configuration; using osu.Game.GameModes.Play; using osu.Game.Graphics; +using osu.Framework.Graphics.Sprites; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/ToolbarButton.cs b/osu.Game/Overlays/ToolbarButton.cs index 79cd79aee0..3d74f7724e 100644 --- a/osu.Game/Overlays/ToolbarButton.cs +++ b/osu.Game/Overlays/ToolbarButton.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/ToolbarModeSelector.cs b/osu.Game/Overlays/ToolbarModeSelector.cs index d73c7dc8a9..7f82ab3e90 100644 --- a/osu.Game/Overlays/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/ToolbarModeSelector.cs @@ -6,12 +6,12 @@ using System.Linq; using osu.Framework.Cached; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Transformations; using osu.Game.GameModes.Play; using OpenTK; using OpenTK.Graphics; using osu.Framework; +using osu.Framework.Graphics.Sprites; namespace osu.Game.Overlays { diff --git a/osu.Game/VolumeMeter.cs b/osu.Game/VolumeMeter.cs index 121059a380..a9afe62820 100644 --- a/osu.Game/VolumeMeter.cs +++ b/osu.Game/VolumeMeter.cs @@ -1,7 +1,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; From b3e531b98cb2fec1ee972ca84b50b2b716de6d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Oct 2016 14:10:24 +0200 Subject: [PATCH 2/3] Remove implementation of WedgedBox and use Shear transformation instead. --- osu.Game/GameModes/Menu/Button.cs | 51 +++++++------------------------ 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/osu.Game/GameModes/Menu/Button.cs b/osu.Game/GameModes/Menu/Button.cs index 46fc627483..91cf7c473f 100644 --- a/osu.Game/GameModes/Menu/Button.cs +++ b/osu.Game/GameModes/Menu/Button.cs @@ -20,7 +20,7 @@ namespace osu.Game.GameModes.Menu public class Button : AutoSizeContainer, IStateful { private Container iconText; - private WedgedBox box; + private Box box; private Color4 colour; private TextAwesome icon; private string internalName; @@ -30,7 +30,10 @@ namespace osu.Game.GameModes.Menu private Key triggerKey; private string text; - public override Quad ScreenSpaceInputQuad => box.ScreenSpaceInputQuad; + public override bool Contains(Vector2 screenSpacePos) + { + return box.Contains(screenSpacePos); + } public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { @@ -48,14 +51,18 @@ namespace osu.Game.GameModes.Menu base.Load(game); Alpha = 0; + Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height); + Children = new Drawable[] { - box = new WedgedBox(new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height), ButtonSystem.wedge_width) + box = new Box { Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = colour, - Scale = new Vector2(0, 1) + Scale = new Vector2(0, 1), + Size = boxSize, + Shear = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0), }, iconText = new AutoSizeContainer { @@ -266,42 +273,6 @@ namespace osu.Game.GameModes.Menu } } } - - /// - /// ________ - /// / / - /// / / - /// /_______/ - /// - class WedgedBox : Box - { - float wedgeWidth; - - public WedgedBox(Vector2 boxSize, float wedgeWidth) - { - Size = boxSize; - this.wedgeWidth = wedgeWidth; - } - - /// - /// Custom DrawQuad used to create the slanted effect. - /// - protected override Quad DrawQuad - { - get - { - Quad q = base.DrawQuad; - - //Will become infinite if we don't limit its maximum size. - float wedge = Math.Min(q.Width, wedgeWidth / Scale.X); - - q.TopLeft.X += wedge; - q.BottomRight.X -= wedge; - - return q; - } - } - } } public enum ButtonState From d3fd16f209295c10404852a5a6b54f8ddf8386c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 16 Oct 2016 15:34:30 +0200 Subject: [PATCH 3/3] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 1b66dff887..5dc6a02088 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1b66dff88718c7c7439a5d12d0232db8f7b62f49 +Subproject commit 5dc6a02088d0fac39810fc2da26ac0de72551939