osu/osu.Game/Graphics/Sprites/GlowingSpriteText.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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 14:36:46 +00:00
private const float blur_sigma = 3f;
private OsuSpriteText text = null!;
public LocalisableString Text
{
2024-01-16 14:36:46 +00:00
get => text.Text;
set => text.Text = value;
}
2019-07-22 20:16:54 +00:00
public FontUsage Font
{
2024-01-16 14:36:46 +00:00
get => text.Font;
set => text.Font = value.With(fixedWidth: true);
}
public Vector2 TextSize
{
2024-01-16 14:36:46 +00:00
get => text.Size;
set => text.Size = value;
}
public ColourInfo TextColour
{
2024-01-16 14:36:46 +00:00
get => text.Colour;
set => text.Colour = value;
}
2020-03-17 07:24:33 +00:00
public Vector2 Spacing
{
2024-01-16 14:36:46 +00:00
get => text.Spacing;
set => text.Spacing = value;
2020-03-17 07:24:33 +00:00
}
public bool UseFullGlyphHeight
{
2024-01-16 14:36:46 +00:00
get => text.UseFullGlyphHeight;
set => text.UseFullGlyphHeight = value;
2020-03-17 07:24:33 +00:00
}
public Bindable<string> Current
{
2024-01-16 14:36:46 +00:00
get => text.Current;
set => text.Current = value;
}
public GlowingSpriteText()
{
2024-01-16 14:36:46 +00:00
BlurSigma = new Vector2(blur_sigma);
EffectBlending = BlendingParameters.Additive;
}
protected override Drawable CreateDrawable() => text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shadow = false,
};
}
}