public virtual void Draw(SpriteBatch spriteBatch, DrawProperties worldProperties) { if (this.Texture == null) { return; } if (animating) { spriteBatch.Draw(Texture, worldProperties.Position, new Rectangle(currentAnimation.frames[currentFrame] * Width, 0, Width, Height), this.Color * worldProperties.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(worldProperties.Depth)); } else { spriteBatch.Draw(Texture, worldProperties.Position, this.SourceRectangle, this.Color * worldProperties.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(worldProperties.Depth)); } }
public override void Draw(SpriteBatch spriteBatch, WorldProperties worldProperties) { if (this.Text == "") { return; } this.TextSize = this.SpriteFont.MeasureString(this.Text); worldProperties.Position.X *= this.ScrollFactor.X; worldProperties.Position.Y *= this.ScrollFactor.Y; worldProperties.Position.X += this.Width / 2 - this.TextSize.X / 2; worldProperties.Position.Y += this.Height / 2 - this.TextSize.Y / 2; spriteBatch.DrawString( this.SpriteFont, this.Text, worldProperties.Position, this.Color * worldProperties.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(this.WorldDepth)); }
public virtual void Draw(SpriteBatch spriteBatch, WorldProperties worldProperties) { if (this.Texture == null) { return; } worldProperties.Position.X *= this.ScrollFactor.X; worldProperties.Position.Y *= this.ScrollFactor.Y; worldProperties.Position.X = (float)Math.Round(worldProperties.Position.X); worldProperties.Position.Y = (float)Math.Round(worldProperties.Position.Y); if (Animating) { spriteBatch.Draw(Texture, worldProperties.Position, new Rectangle(CurrentAnimation.frames[CurrentFrame] * Width, 0, Width, Height), this.Color * worldProperties.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(worldProperties.Depth)); } else { spriteBatch.Draw(Texture, worldProperties.Position, this.SourceRectangle, this.Color * worldProperties.Alpha, this.Rotation, this.Origin, this.Scale, this.SpriteEffects, Node.GetDrawDepth(worldProperties.Depth)); } }