mirror of https://github.com/ppy/osu
Add texture wrapping support to GetAnimation()
This commit is contained in:
parent
fc0f3f9171
commit
afca535abe
|
@ -2,6 +2,7 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.OpenGL.Textures;
|
||||
using osu.Framework.Timing;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
|
@ -11,7 +12,7 @@ namespace osu.Game.Skinning
|
|||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should not be used to start an animation immediately at the current time.
|
||||
/// To do so, use <see cref="LegacySkinExtensions.GetAnimation"/> with <code>startAtCurrentTime = true</code> instead.
|
||||
/// To do so, use <see cref="LegacySkinExtensions.GetAnimation(ISkin, string, WrapMode, WrapMode, bool, bool, bool, string, bool, double?)"/> with <code>startAtCurrentTime = true</code> instead.
|
||||
/// </remarks>
|
||||
[Cached]
|
||||
public interface IAnimationTimeReference
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osu.Framework.Graphics.OpenGL.Textures;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
|
@ -15,6 +16,11 @@ public static class LegacySkinExtensions
|
|||
{
|
||||
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-",
|
||||
bool startAtCurrentTime = true, double? frameLength = null)
|
||||
=> source.GetAnimation(componentName, default, default, animatable, looping, applyConfigFrameRate, animationSeparator, startAtCurrentTime, frameLength);
|
||||
|
||||
public static Drawable GetAnimation(this ISkin source, string componentName, WrapMode wrapModeS, WrapMode wrapModeT, bool animatable, bool looping, bool applyConfigFrameRate = false,
|
||||
string animationSeparator = "-",
|
||||
bool startAtCurrentTime = true, double? frameLength = null)
|
||||
{
|
||||
Texture texture;
|
||||
|
||||
|
@ -38,7 +44,7 @@ public static Drawable GetAnimation(this ISkin source, string componentName, boo
|
|||
}
|
||||
|
||||
// if an animation was not allowed or not found, fall back to a sprite retrieval.
|
||||
if ((texture = source.GetTexture(componentName)) != null)
|
||||
if ((texture = source.GetTexture(componentName, wrapModeS, wrapModeT)) != null)
|
||||
return new Sprite { Texture = texture };
|
||||
|
||||
return null;
|
||||
|
@ -47,7 +53,7 @@ IEnumerable<Texture> getTextures()
|
|||
{
|
||||
for (int i = 0; true; i++)
|
||||
{
|
||||
if ((texture = source.GetTexture($"{componentName}{animationSeparator}{i}")) == null)
|
||||
if ((texture = source.GetTexture($"{componentName}{animationSeparator}{i}", wrapModeS, wrapModeT)) == null)
|
||||
break;
|
||||
|
||||
yield return texture;
|
||||
|
|
Loading…
Reference in New Issue