2022-11-02 03:54:52 +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.
|
|
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Configuration;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning.Components
|
|
|
|
{
|
|
|
|
[UsedImplicitly]
|
2022-11-26 23:30:10 +08:00
|
|
|
public partial class TextElement : Container, ISkinnableDrawable
|
2022-11-02 03:54:52 +08:00
|
|
|
{
|
|
|
|
public bool UsesFixedAnchor { get; set; }
|
|
|
|
|
2022-11-23 15:31:50 +08:00
|
|
|
[SettingSource("Text", "The text to be displayed.")]
|
2022-11-02 03:54:52 +08:00
|
|
|
public Bindable<string> Text { get; } = new Bindable<string>("Circles!");
|
|
|
|
|
|
|
|
public TextElement()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
OsuSpriteText text;
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
text = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Font = OsuFont.Default.With(size: 40)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
text.Current.BindTo(Text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|