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