1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 02:12:56 +08:00
osu-lazer/osu.Game/Screens/Play/BreaksOverlay/GlowIcon.cs

67 lines
1.9 KiB
C#
Raw Normal View History

2017-09-21 06:44:30 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
2017-09-22 06:16:05 +08:00
using osu.Framework.Graphics;
2017-09-21 06:44:30 +08:00
using osu.Game.Graphics;
2017-09-22 06:16:05 +08:00
using OpenTK;
using osu.Framework.Allocation;
2017-09-21 06:44:30 +08:00
namespace osu.Game.Screens.Play.BreaksOverlay
{
2017-09-22 06:16:05 +08:00
public class GlowIcon : Container
2017-09-21 06:44:30 +08:00
{
2017-09-22 06:16:05 +08:00
private readonly SpriteIcon spriteIcon;
2017-09-23 01:43:51 +08:00
private readonly BlurredIcon blurredIcon;
2017-09-21 06:44:30 +08:00
public override Vector2 Size
{
set
{
2017-09-23 01:43:51 +08:00
blurredIcon.Size = value;
spriteIcon.Size = value - new Vector2(10); //Make it a bit smaller to make blur more visible
blurredIcon.ForceRedraw();
2017-09-21 06:44:30 +08:00
}
2017-09-23 01:43:51 +08:00
get { return base.Size; }
}
public Vector2 BlurSigma
{
set { blurredIcon.BlurSigma = value; }
get { return blurredIcon.BlurSigma; }
2017-09-21 06:44:30 +08:00
}
2017-09-22 06:16:05 +08:00
public FontAwesome Icon
{
2017-09-23 01:43:51 +08:00
set { spriteIcon.Icon = blurredIcon.Icon = value; }
2017-09-22 06:16:05 +08:00
get { return spriteIcon.Icon; }
}
public GlowIcon()
2017-09-21 06:44:30 +08:00
{
RelativePositionAxes = Axes.X;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
2017-09-23 01:43:51 +08:00
blurredIcon = new BlurredIcon
2017-09-21 06:44:30 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
2017-09-22 06:16:05 +08:00
spriteIcon = new SpriteIcon
2017-09-21 06:44:30 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shadow = false,
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
2017-09-23 01:43:51 +08:00
blurredIcon.Colour = colours.Blue;
2017-09-21 06:44:30 +08:00
}
}
}