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)); } }
/** * DrawCall version when no parent properties are being given */ public void DrawCall(SpriteBatch spriteBatch) { DrawProperties worldProperties = new DrawProperties(); worldProperties.Position = this.Position; worldProperties.Alpha = this.Alpha; worldProperties.Depth = this.Depth; this.DrawCall(spriteBatch, worldProperties); }
public override void Draw(SpriteBatch spriteBatch, DrawProperties worldProperties) { int amountX = this.TiledWidth / this.Texture.Width; int amountY = this.TiledHeight / this.Texture.Height; DrawProperties newworldProperties = new DrawProperties(); newworldProperties.Alpha = this.Alpha; for (int x = 0; x < amountX; x++) { for (int y = 0; y < amountY; y++) { newworldProperties.Position = worldProperties.Position + new Vector2(x * this.Texture.Width * this.Scale.X, y * this.Texture.Height * this.Scale.Y); base.Draw(spriteBatch, newworldProperties); } } }
public virtual void DrawCall(SpriteBatch spriteBatch, DrawProperties worldProperties) { if (!Visable || !Active) { return; } worldProperties.Position += this.Position; worldProperties.Alpha = Math.Min(this.Alpha, worldProperties.Alpha); worldProperties.Depth += this.Depth; int childrenCount = this.Children.Count; for (int i = 0; i < childrenCount; i++) { this.Children[i].DrawCall(spriteBatch, worldProperties); } }
public override void Draw(SpriteBatch spriteBatch, DrawProperties worldProperties) { if (this.Text == "") { return; } this.TextSize = this.SpriteFont.MeasureString(this.Text); 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 override void DrawCall(SpriteBatch spriteBatch, DrawProperties worldProperties) { worldProperties.Position += this.Position; worldProperties.Alpha = Math.Min(this.Alpha, worldProperties.Alpha); if (!Visable) { return; } this.SpriteEffects = SpriteEffects.None; if (Facing == Facing.Left) { this.SpriteEffects = SpriteEffects.FlipHorizontally; } this.Draw(spriteBatch, worldProperties); worldProperties.Position -= this.Position; base.DrawCall(spriteBatch, worldProperties); }