Make symbol pieces relative sized.

This commit is contained in:
smoogipooo
2017-08-03 15:57:45 +09:30
parent 09c0e18a04
commit 74e9449a75
3 changed files with 38 additions and 11 deletions

View File

@ -1,7 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
@ -9,18 +12,34 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
/// <summary>
/// The symbol used for swell pieces.
/// </summary>
public class SwellSymbolPiece : TextAwesome
public class SwellSymbolPiece : Container
{
private readonly TextAwesome symbol;
public SwellSymbolPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
TextSize = CirclePiece.SYMBOL_INNER_SIZE;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(CirclePiece.SYMBOL_SIZE);
Padding = new MarginPadding(CirclePiece.SYMBOL_BORDER);
Icon = FontAwesome.fa_asterisk;
UseFullGlyphHeight = true;
Shadow = false;
Children = new[]
{
symbol = new TextAwesome
{
Icon = FontAwesome.fa_asterisk,
UseFullGlyphHeight = true,
Shadow = false
}
};
}
protected override void Update()
{
base.Update();
symbol.TextSize = Math.Min(ChildSize.X, ChildSize.Y);
}
}
}