1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Add helper methods

This commit is contained in:
smoogipoo 2020-08-22 00:15:58 +09:00
parent 88d50b6c47
commit 2424fa0802

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osuTK.Graphics;
using static osu.Game.Skinning.LegacySkinConfiguration; using static osu.Game.Skinning.LegacySkinConfiguration;
namespace osu.Game.Skinning namespace osu.Game.Skinning
@ -62,6 +63,21 @@ namespace osu.Game.Skinning
} }
} }
public static Color4 ToLegacyColour(this Color4 colour)
{
if (colour.A == 0)
colour.A = 1;
return colour;
}
public static T WithInitialColour<T>(this T drawable, Color4 colour)
where T : Drawable
{
drawable.Alpha = colour.A;
drawable.Colour = ToLegacyColour(colour);
return drawable;
}
public class SkinnableTextureAnimation : TextureAnimation public class SkinnableTextureAnimation : TextureAnimation
{ {
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]