Example #1
0
 public Spriter(string scmlPath, FileLoader loader)
 {
     this.scmlPath = scmlPath;
     this.spriterData = Com.Brashmonkey.Spriter.xml.SCMLReader.load(scmlPath);
     this.loader = loader;
     loadResources();
 }
 public SpriterModObject()
     : base()
 {
     this.alpha = 1f;
     this.@ref = null;
     this.loader = null;
     this.active = true;
 }
 public virtual void setLoader(FileLoader loader)
 {
     this.loader = loader;
 }
Example #4
0
 /// <summary>Creates a spriter object.</summary>
 /// <remarks>Creates a spriter object.</remarks>
 /// <param name="path">Path to the scml file</param>
 /// <param name="loader">a loader extended from the AbstractLoader</param>
 /// <returns>a Spriter Object</returns>
 public static Spriter getSpriter(string path, FileLoader loader)
 {
     return new Spriter(path, loader);
 }
 /// <summary>Constructs a new SpriterAbstractPlayer object which is able to animate SpriterBone instances and SpriterObject instances.
 /// 	</summary>
 /// <remarks>Constructs a new SpriterAbstractPlayer object which is able to animate SpriterBone instances and SpriterObject instances.
 /// 	</remarks>
 /// <param name="loader">
 /// 
 /// <see cref="FileLoader{I}">FileLoader&lt;I&gt;
 /// 	</see>
 /// which you have to implement on your own.
 /// </param>
 /// <param name="keyframes">
 /// A list of SpriterKeyFrame arrays. See
 /// <see cref="SpriterKeyFrameProvider.generateKeyFramePool(com.discobeard.spriter.dom.SpriterData, com.discobeard.spriter.dom.Entity)
 /// 	">SpriterKeyFrameProvider.generateKeyFramePool(com.discobeard.spriter.dom.SpriterData, com.discobeard.spriter.dom.Entity)
 /// 	</see>
 /// to get the list.
 /// Generate these keyframes once to save memory.
 /// </param>
 public SpriterAbstractPlayer(FileLoader loader, IList<SpriterAnimation> animations)
 {
     this.loader = loader;
     this.animations = animations;
     this.rootParent = new SpriterBone();
     this.tempParent = new SpriterBone();
     this.rootParent.setName("playerRoot");
     this.tempParent.setName("playerRoot");
     this.lastFrame = new SpriterKeyFrame();
     this.lastTempFrame = new SpriterKeyFrame();
     this.interpolator = SpriterLinearInterpolator
         .interpolator;
     this.players = new List<SpriterAbstractPlayer>();
     rect = new SpriterRectangle(0, 0, 0, 0);
 }
Example #6
0
        /// <summary>Constructs a new SpriterPlayer object which animates the given Spriter entity.
        /// 	</summary>
        /// <remarks>Constructs a new SpriterPlayer object which animates the given Spriter entity.
        /// 	</remarks>
        /// <param name="data">
        /// 
        /// <see cref="Com.Brashmonkey.Spriter.Spriter">Com.Brashmonkey.Spriter.Spriter</see>
        /// which provides a method to load all needed data to animate. See
        /// <see cref="Spriter#getSpriter(String,com.spriter.file.FileLoader)">Spriter#getSpriter(String,com.spriter.file.FileLoader)
        /// 	</see>
        /// for mor information.
        /// </param>
        /// <param name="entityIndex">The index of the entity which should be handled by this player.
        /// 	</param>
        /// <param name="loader">The loader which has loaded all necessary sprites for the scml file.
        /// 	</param>
        public SpriterPlayer(Com.Brashmonkey.Spriter.Spriter spriter, int entityIndex, FileLoader loader)
            : this(spriter.getSpriterData(), spriter.getSpriterData().getEntity
			()[entityIndex], loader)
        {
        }
Example #7
0
        /// <summary>Constructs a new SpriterPlayer object which animates the given Spriter entity.
        /// 	</summary>
        /// <remarks>Constructs a new SpriterPlayer object which animates the given Spriter entity.
        /// 	</remarks>
        /// <param name="data">
        /// 
        /// <see cref="SpriterData">SpriterData
        /// 	</see>
        /// which provides a method to load all needed data to animate. See
        /// <see cref="Spriter#getSpriter(String,com.spriter.file.FileLoader)">Spriter#getSpriter(String,com.spriter.file.FileLoader)
        /// 	</see>
        /// for mor information.
        /// </param>
        /// <param name="entityIndex">The index of the entity which should be handled by this player.
        /// 	</param>
        /// <param name="loader">The loader which has loaded all necessary sprites for the scml file.
        /// 	</param>
        public SpriterPlayer(SpriterData data, int entityIndex, FileLoader loader)
            : this(data, data.getEntity
			()[entityIndex], loader)
        {
        }
Example #8
0
        /// <summary>Constructs a new SpriterPlayer object which animates the given Spriter entity.
        /// 	</summary>
        /// <remarks>Constructs a new SpriterPlayer object which animates the given Spriter entity.
        /// 	</remarks>
        /// <param name="data">
        /// 
        /// <see cref="SpriterData">SpriterData
        /// 	</see>
        /// which provides a method to load all needed data to animate. See
        /// <see cref="Spriter#getSpriter(String,com.spriter.file.FileLoader)">Spriter#getSpriter(String,com.spriter.file.FileLoader)
        /// 	</see>
        /// for mor information.
        /// </param>
        /// <param name="entityIndex">The entity which should be handled by this player.</param>
        /// <param name="loader">The loader which has loaded all necessary sprites for the scml file.
        /// 	</param>
        public SpriterPlayer(SpriterData data, Entity
			 entity, FileLoader loader)
            : base(loader, null)
        {
            this.entity = entity;
            this.frame = 0;
            if (!alreadyLoaded(entity))
            {
                this.animations = SpriterKeyFrameProvider.generateKeyFramePool(data, entity);
                loaded.Add(entity, this);
            }
            else
            {
                this.animations = loaded[entity].animations;
            }
            this.generateData();
            this.animation = this.animations[0];
            this.firstKeyFrame = this.animation.frames[0];
            this.update(0, 0);
        }