public Sprite(SubTexture texture, Vector?size = null, Vector?origin = null, Mask?maskShape = null) { this.AnimationStrip = new AnimationStrip(texture); this.Size = size ?? texture.Size; this._origin = origin; this._maskShape = maskShape ?? Mask.Automatic; }
public void DrawTexture(SubTexture texture, double xOrigin, double yOrigin, Matrix transform, Color blend) { Contract.Requires <ObjectDisposedException>(!texture.Texture.IsDisposed); _renderSystem.SetVertices(new[] { transform *new GraphicsPoint(-xOrigin, -yOrigin), transform * new GraphicsPoint(texture.Width - xOrigin, -yOrigin), transform * new GraphicsPoint(-xOrigin, texture.Height - yOrigin), transform * new GraphicsPoint(texture.Width - xOrigin, texture.Height - yOrigin), }); _renderSystem.SetColor(blend); _renderSystem.SetTexCoords(texture.TriangleStripCoords); _renderSystem.Render(texture.Texture, PrimitiveType.TriangleStrip); }