1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 18:27:31 +08:00
osu-lazer/osu.Game/Graphics/Sprites/GlowingSpriteText.cs

75 lines
1.8 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.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osuTK;
namespace osu.Game.Graphics.Sprites
{
public partial class GlowingSpriteText : GlowingDrawable, IHasText
{
2024-01-16 22:36:46 +08:00
private const float blur_sigma = 3f;
private OsuSpriteText text = null!;
public LocalisableString Text
{
2024-01-16 22:36:46 +08:00
get => text.Text;
set => text.Text = value;
}
2019-07-23 04:16:54 +08:00
public FontUsage Font
{
2024-01-16 22:36:46 +08:00
get => text.Font;
set => text.Font = value.With(fixedWidth: true);
}
public Vector2 TextSize
{
2024-01-16 22:36:46 +08:00
get => text.Size;
set => text.Size = value;
}
public ColourInfo TextColour
{
2024-01-16 22:36:46 +08:00
get => text.Colour;
set => text.Colour = value;
}
2020-03-17 15:24:33 +08:00
public Vector2 Spacing
{
2024-01-16 22:36:46 +08:00
get => text.Spacing;
set => text.Spacing = value;
2020-03-17 15:24:33 +08:00
}
public bool UseFullGlyphHeight
{
2024-01-16 22:36:46 +08:00
get => text.UseFullGlyphHeight;
set => text.UseFullGlyphHeight = value;
2020-03-17 15:24:33 +08:00
}
public Bindable<string> Current
{
2024-01-16 22:36:46 +08:00
get => text.Current;
set => text.Current = value;
}
public GlowingSpriteText()
{
2024-01-16 22:36:46 +08:00
BlurSigma = new Vector2(blur_sigma);
EffectBlending = BlendingParameters.Additive;
}
protected override Drawable CreateDrawable() => text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shadow = false,
};
}
}