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