mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Allow Rulesets to create a non-FontAwesome icon
This also - Renames TextAwesome to SpriteIcon. - Removes the default size of "20" from SpriteIcon (now defaults to the underlying texture size).
This commit is contained in:
@ -286,7 +286,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
{
|
||||
public const float LABEL_LEFT_MARGIN = 20;
|
||||
|
||||
private readonly TextAwesome statusIcon;
|
||||
private readonly SpriteIcon statusIcon;
|
||||
public Color4 StatusColour
|
||||
{
|
||||
set
|
||||
@ -308,15 +308,15 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
Radius = 4,
|
||||
};
|
||||
|
||||
Icon.TextSize = 14;
|
||||
Icon.Size = new Vector2(14);
|
||||
Icon.Margin = new MarginPadding(0);
|
||||
|
||||
Foreground.Add(statusIcon = new TextAwesome
|
||||
Foreground.Add(statusIcon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Icon = FontAwesome.fa_circle_o,
|
||||
TextSize = 14,
|
||||
Size = new Vector2(14),
|
||||
});
|
||||
|
||||
Text.Margin = new MarginPadding { Left = LABEL_LEFT_MARGIN };
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets;
|
||||
using OpenTK;
|
||||
@ -27,12 +28,14 @@ namespace osu.Game.Overlays.Settings
|
||||
|
||||
foreach (var ruleset in rulesets.AllRulesets)
|
||||
{
|
||||
modes.Add(new TextAwesome
|
||||
var icon = new ConstrainedIconContainer
|
||||
{
|
||||
Icon = ruleset.CreateInstance().Icon,
|
||||
Icon = ruleset.CreateInstance().CreateIcon(),
|
||||
Colour = Color4.Gray,
|
||||
TextSize = 20
|
||||
});
|
||||
Size = new Vector2(20),
|
||||
};
|
||||
|
||||
modes.Add(icon);
|
||||
}
|
||||
|
||||
Children = new Drawable[]
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public class SidebarButton : Container
|
||||
{
|
||||
private readonly TextAwesome drawableIcon;
|
||||
private readonly SpriteIcon drawableIcon;
|
||||
private readonly SpriteText headerText;
|
||||
private readonly Box backgroundBox;
|
||||
private readonly Box selectionIndicator;
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Settings
|
||||
Width = Sidebar.DEFAULT_WIDTH,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Colour = OsuColour.Gray(0.6f),
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
headerText = new OsuSpriteText
|
||||
{
|
||||
@ -85,11 +85,11 @@ namespace osu.Game.Overlays.Settings
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
drawableIcon = new TextAwesome
|
||||
drawableIcon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 20
|
||||
Size = new Vector2(20),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user