mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 21:07:59 +09:00
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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.OpenGL.Textures;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
@ -11,7 +12,7 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This should not be used to start an animation immediately at the current time.
|
/// 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>
|
/// </remarks>
|
||||||
[Cached]
|
[Cached]
|
||||||
public interface IAnimationTimeReference
|
public interface IAnimationTimeReference
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
|
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;
|
||||||
|
|
||||||
@ -15,6 +16,11 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-",
|
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-",
|
||||||
bool startAtCurrentTime = true, double? frameLength = null)
|
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;
|
Texture texture;
|
||||||
|
|
||||||
@ -38,7 +44,7 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if an animation was not allowed or not found, fall back to a sprite retrieval.
|
// 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 new Sprite { Texture = texture };
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -47,7 +53,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
for (int i = 0; true; i++)
|
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;
|
break;
|
||||||
|
|
||||||
yield return texture;
|
yield return texture;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user