mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 15:43:18 +08:00
Simplify glowing icons in break overlay
This commit is contained in:
parent
54472e6452
commit
58a68e94af
@ -1,52 +1,16 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.Break
|
namespace osu.Game.Screens.Play.Break
|
||||||
{
|
{
|
||||||
public partial class BlurredIcon : BufferedContainer
|
public partial class BlurredIcon : GlowIcon
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon icon;
|
|
||||||
|
|
||||||
public IconUsage Icon
|
|
||||||
{
|
|
||||||
set => icon.Icon = value;
|
|
||||||
get => icon.Icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector2 Size
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
icon.Size = value;
|
|
||||||
base.Size = value + BlurSigma * 5;
|
|
||||||
ForceRedraw();
|
|
||||||
}
|
|
||||||
get => base.Size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlurredIcon()
|
public BlurredIcon()
|
||||||
: base(cachedFrameBuffer: true)
|
|
||||||
{
|
{
|
||||||
RelativePositionAxes = Axes.X;
|
EffectBlending = BlendingParameters.Additive;
|
||||||
Child = icon = new SpriteIcon
|
DrawOriginal = false;
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Shadow = false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Colour = colours.BlueLighter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,64 +3,45 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.Break
|
namespace osu.Game.Screens.Play.Break
|
||||||
{
|
{
|
||||||
public partial class GlowIcon : Container
|
public partial class GlowIcon : GlowingDrawable
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon spriteIcon;
|
private SpriteIcon icon = null!;
|
||||||
private readonly BlurredIcon blurredIcon;
|
|
||||||
|
|
||||||
public override Vector2 Size
|
|
||||||
{
|
|
||||||
get => base.Size;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
blurredIcon.Size = spriteIcon.Size = value;
|
|
||||||
blurredIcon.ForceRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector2 BlurSigma
|
|
||||||
{
|
|
||||||
get => blurredIcon.BlurSigma;
|
|
||||||
set => blurredIcon.BlurSigma = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IconUsage Icon
|
public IconUsage Icon
|
||||||
{
|
{
|
||||||
get => spriteIcon.Icon;
|
set => icon.Icon = value;
|
||||||
set => spriteIcon.Icon = blurredIcon.Icon = value;
|
get => icon.Icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public new Vector2 Size
|
||||||
|
{
|
||||||
|
set => icon.Size = value;
|
||||||
|
get => icon.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlowIcon()
|
public GlowIcon()
|
||||||
{
|
{
|
||||||
RelativePositionAxes = Axes.X;
|
RelativePositionAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
blurredIcon = new BlurredIcon
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
},
|
|
||||||
spriteIcon = new SpriteIcon
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Shadow = false,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
blurredIcon.Colour = colours.Blue;
|
GlowColour = colours.BlueLighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateDrawable() => icon = new SpriteIcon
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Shadow = false,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user