public Sprite() : base() { _blendingType = DrawingBlendingType.Alpha; _drawRequest = default(DrawRequest); _drawRequest.tint = Color.White; _drawRequest.scaleRatio = Vector2.One; this.MaterialArea = ""; _useTilingSafeBorders = false; this.AutoScroll = false; this.AutoScrollSpeed = 0; this.AutoScrollArea = 0; this.AutoScrollVertical = false; this.AutoScrollMirroring = false; }
public void Draw(float elapsed) { if (this.Parent.Material == null) { return; } DrawRequest _drawRequest = new DrawRequest(); _drawRequest.texture = this.Parent.Material.Texture; _drawRequest.position = this.Parent.Position; _drawRequest.rotation = this.Parent.Rotation; _drawRequest.scaleRatio = this.Parent.Scale; if (this.AnimationFrames != null && this.AnimationFrames.Count > _currentFrameIndex && this.Parent.Material.Areas.ContainsKey(this.AnimationFrames[_currentFrameIndex].Area)) { _drawRequest.sourceRectangle = this.Parent.Material. Areas[this.AnimationFrames[_currentFrameIndex].Area]; } else { _drawRequest.sourceRectangle = null; } _drawRequest.pivot = this.Parent.Pivot; _drawRequest.isPivotRelative = this.Parent.IsPivotRelative; _drawRequest.tint = this.Parent.Tint; _drawRequest.hFlip = this.Parent.FlipHorizontal; _drawRequest.vFlip = this.Parent.FlipVertical; DrawingManager.DrawOnLayer(_drawRequest, this.Parent.Layer, this.Parent.BlendingType); }