// // Constructors // public SpriteEntity() : base() { this.imageMapping = null; this.sprite = null; this.scaleX = 1.0f; this.scaleY = 1.0f; this.angle = 0.0f; }
/// <summary> /// Clears the data in the Sprite /// </summary> /// <remarks> /// Does not clear base data. Use <c>BaseReset()</c> for that. /// </remarks> public override void Reset() { this.sprite = null; this.imageMapping = null; this.scaleX = 1.0f; this.scaleY = 1.0f; this.angle = 0.0f; this.SpriteReset(); }
/////////////////////////////////////////////////////// // // Methods // /////////////////////////////////////////////////////// /// <summary> /// Creates the sprite from the memory pool /// </summary> /// <param name="newName"></param> /// <param name="imageName"></param> /// <returns></returns> public SpriteEntity Create(Sprite.Name newName, Image.Name imageName) { if (newName == Sprite.Name.NULL || newName == Sprite.Name.UNINITIALIZED) { return(nullSprite); } Image image = ImageManager.Self.Find(imageName); SpriteEntity newSprite = this.BaseCreate() as SpriteEntity; newSprite.SetName(newName); newSprite.SetMapping(image); Azul.Sprite2D sprite = new Azul.Sprite2D(image.Texture.TextureMap, image.ImageMapping, new Azul.Rect(0, 0, image.Width, image.Height) ); newSprite.SetSprite(sprite); return(newSprite); }
// // Methods // /// <summary> /// Changes the Azul Sprite reference /// </summary> /// <param name="newSprite"></param> public void SetSprite(Azul.Sprite2D newSprite) { this.sprite = newSprite; }
public void set(SpriteEnum sName, Index index, ImageEnum iName, float x, float y, float width, float height) { base.setBase(sName, index, x, y); this.img = ImageManager.find(iName); this.sprite = new Azul.Sprite2D(this.img.getTexture(), this.img.TexCoords, new Azul.Rect(x, y, width, height)); this.sprRect = new Azul.Rect(x, y, width, height); angle = 0; scaleX = this.sprite.sx; scaleY = this.sprite.sy; }
public GameSprite() : base() { sprite = null; }