/// <summary> /// Creates a new sprite instance. /// </summary> /// <param name="texture">The texture associated with the sprite.</param> /// <param name="position">The position at which the sprite should be drawn.</param> /// <param name="scale">The scale at which the sprite should be drawn.</param> public Sprite(AnimatedTexture texture, Vector2 position, Vector2 scale) { Texture = texture; this.position = position; this.scale = scale; anchor = Anchor.Center; ticksPerFrame = 1; looped = true; color = Color.White; animationCurveStack = new List<AnimationCurve>(10); }
/// <summary> /// Creates a new sprite instance. /// </summary> /// <param name="texture">The texture associated with the sprite.</param> public Sprite(AnimatedTexture texture) : this(texture, Vector2.Zero, Vector2.One) { }
/// <summary> /// Creates a new sprite instance. /// </summary> /// <param name="texture">The texture associated with the sprite.</param> /// <param name="position">The position at which the sprite should be drawn.</param> public Sprite(AnimatedTexture texture, Vector2 position) : this(texture, position, Vector2.One) { }
public static AnimatedTexture Build(AssetManager assets, string assetName) { int columns = 1; int rows = 1; float scale = 1; TextDictionary td = assets.GetDictionary("graphics"); if (td.CheckPropertyExists(assetName, "columns")) columns = td.LookupInt32(assetName, "columns"); if (td.CheckPropertyExists(assetName, "rows")) rows = td.LookupInt32(assetName, "rows"); if (td.CheckPropertyExists(assetName, "scale")) scale = td.LookupSingle(assetName, "scale"); AnimatedTexture sprite = new AnimatedTexture(assetName, assets.GetTexture(assetName), columns, rows, scale); return sprite; }