osu/osu.Game/Overlays/Direct/IconPill.cs

52 lines
1.4 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 09:19:50 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
2018-11-20 07:51:59 +00:00
using osuTK;
using osuTK.Graphics;
2018-04-13 09:19:50 +00:00
namespace osu.Game.Overlays.Direct
{
public class IconPill : CircularContainer
{
2019-03-05 08:14:49 +00:00
public Vector2 IconSize
{
get => iconContainer.Size;
set => iconContainer.Size = value;
}
private readonly Container iconContainer;
public IconPill(IconUsage icon)
2018-04-13 09:19:50 +00:00
{
AutoSizeAxes = Axes.Both;
Masking = true;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
2019-03-05 08:14:49 +00:00
iconContainer = new Container
2018-04-13 09:19:50 +00:00
{
2019-03-05 08:14:49 +00:00
Size = new Vector2(22),
Padding = new MarginPadding(5),
2018-04-13 09:19:50 +00:00
Child = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2019-03-05 08:14:49 +00:00
RelativeSizeAxes = Axes.Both,
2018-04-13 09:19:50 +00:00
Icon = icon,
},
},
};
}
}
}