1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-05 14:59:09 +01:00
MLEM/MLEM.Ui/Elements/SpriteAnimationImage.cs

27 lines
901 B
C#
Raw Normal View History

2019-09-12 18:44:24 +02:00
using Microsoft.Xna.Framework;
using MLEM.Animations;
using MLEM.Textures;
namespace MLEM.Ui.Elements {
public class SpriteAnimationImage : Image {
public SpriteAnimationGroup Group;
public SpriteAnimationImage(Anchor anchor, Vector2 size, TextureRegion texture, SpriteAnimationGroup group, bool scaleToImage = false) :
base(anchor, size, texture, scaleToImage) {
this.Group = group;
}
public SpriteAnimationImage(Anchor anchor, Vector2 size, TextureRegion texture, SpriteAnimation animation, bool scaleToImage = false) :
this(anchor, size, texture, new SpriteAnimationGroup().Add(animation, () => true), scaleToImage) {
}
public override void Update(GameTime time) {
base.Update(time);
this.Group.Update(time);
this.Texture = this.Group.CurrentRegion;
}
}
}