1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-20 16:22:56 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/ScreenTitle.cs

80 lines
2.5 KiB
C#
Raw Normal View History

2019-03-09 06:44:01 +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 osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2019-03-29 13:03:00 +08:00
using osu.Framework.Graphics.Sprites;
2019-03-09 06:44:01 +08:00
using osu.Game.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour
2019-03-09 06:44:01 +08:00
{
private readonly SpriteIcon iconSprite;
private readonly OsuSpriteText titleText, pageText;
2019-04-04 06:24:42 +08:00
public const float ICON_WIDTH = icon_size + icon_spacing;
private const float icon_size = 25, icon_spacing = 10;
2019-03-09 06:44:01 +08:00
2019-03-29 13:03:00 +08:00
protected IconUsage Icon
2019-03-09 06:44:01 +08:00
{
set => iconSprite.Icon = value;
}
protected string Title
2019-03-09 06:44:01 +08:00
{
set => titleText.Text = value;
}
protected string Section
2019-03-09 06:44:01 +08:00
{
set => pageText.Text = value;
}
public Color4 AccentColour
{
get => pageText.Colour;
set => pageText.Colour = value;
}
protected ScreenTitle()
2019-03-09 06:44:01 +08:00
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
2019-04-04 06:24:42 +08:00
Spacing = new Vector2(icon_spacing, 0),
Children = new Drawable[]
2019-03-09 06:44:01 +08:00
{
iconSprite = new SpriteIcon
2019-03-09 06:44:01 +08:00
{
2019-04-04 06:24:42 +08:00
Size = new Vector2(icon_size),
2019-03-09 06:44:01 +08:00
},
new FillFlowContainer
2019-03-09 06:44:01 +08:00
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(6, 0),
Children = new[]
{
titleText = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 25),
},
pageText = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 25),
}
}
2019-03-09 06:44:01 +08:00
}
}
},
2019-03-09 06:44:01 +08:00
};
}
}
}