2019-07-21 09:14:55 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
2020-08-28 12:34:34 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-02-22 08:14:00 +00:00
|
|
|
|
using osu.Framework.Localisation;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Sprites
|
|
|
|
|
{
|
2024-03-30 22:20:27 +00:00
|
|
|
|
public partial class GlowingSpriteText : GlowingDrawable, IHasText
|
2019-07-21 09:14:55 +00:00
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
private const float blur_sigma = 3f;
|
|
|
|
|
|
2024-03-30 22:20:27 +00:00
|
|
|
|
private OsuSpriteText text = null!;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
|
2021-02-22 08:14:00 +00:00
|
|
|
|
public LocalisableString Text
|
2019-07-21 09:14:55 +00:00
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
get => text.Text;
|
|
|
|
|
set => text.Text = value;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
}
|
2019-07-22 20:16:54 +00:00
|
|
|
|
|
2019-07-21 09:14:55 +00:00
|
|
|
|
public FontUsage Font
|
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
get => text.Font;
|
|
|
|
|
set => text.Font = value.With(fixedWidth: true);
|
2019-07-21 09:14:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Vector2 TextSize
|
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
get => text.Size;
|
|
|
|
|
set => text.Size = value;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ColourInfo TextColour
|
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
get => text.Colour;
|
|
|
|
|
set => text.Colour = value;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2020-08-28 12:34:34 +00:00
|
|
|
|
public Bindable<string> Current
|
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
get => text.Current;
|
|
|
|
|
set => text.Current = value;
|
2020-08-28 12:34:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-21 09:14:55 +00:00
|
|
|
|
public GlowingSpriteText()
|
|
|
|
|
{
|
2024-01-16 14:36:46 +00:00
|
|
|
|
BlurSigma = new Vector2(blur_sigma);
|
|
|
|
|
EffectBlending = BlendingParameters.Additive;
|
2019-07-21 09:14:55 +00:00
|
|
|
|
}
|
2024-03-30 22:20:27 +00:00
|
|
|
|
|
|
|
|
|
protected override Drawable CreateDrawable() => text = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Shadow = false,
|
|
|
|
|
};
|
2019-07-21 09:14:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|