2019-06-24 13:39:20 +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 System;
|
|
|
|
using osu.Framework.Allocation;
|
2019-07-19 17:38:24 +08:00
|
|
|
using osu.Framework.Graphics;
|
2019-06-24 13:39:20 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning
|
|
|
|
{
|
2019-06-24 14:25:01 +08:00
|
|
|
/// <summary>
|
|
|
|
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
|
|
|
|
/// </summary>
|
2019-07-19 17:38:24 +08:00
|
|
|
public class SkinnableSprite : SkinnableDrawable
|
2019-06-24 13:39:20 +08:00
|
|
|
{
|
2019-06-24 14:25:01 +08:00
|
|
|
protected override bool ApplySizeRestrictionsToDefault => true;
|
2019-06-24 13:39:20 +08:00
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private TextureStore textures { get; set; }
|
|
|
|
|
2019-07-18 11:10:28 +08:00
|
|
|
public SkinnableSprite(string name, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
|
|
|
|
: base(name, allowFallback, confineMode)
|
2019-06-24 13:39:20 +08:00
|
|
|
{
|
|
|
|
}
|
2019-06-24 14:27:46 +08:00
|
|
|
|
2019-07-19 17:38:24 +08:00
|
|
|
protected override Drawable CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
|
2019-06-24 13:39:20 +08:00
|
|
|
}
|
|
|
|
}
|