public override void OnDraw(SpriteBatch spriteBatch) { if (this.IsMouseHoverState) { this.Pen.Color = Color.Yellow; } else { this.Pen.Color = Color.White; } float x = (float)(this.Position.X + (double)(this.Size.Width / 2) - spriteBatch.MeasureString(this.Text, this.Font).X / 2.0); float y = (float)(this.Position.Y + (double)(this.Size.Height / 2) - spriteBatch.MeasureString(this.Text, this.Font).Y / 2.0); Vector2 center = new Vector2(x, y); spriteBatch.DrawRectangle(this.Pen, Sharpex2D.Common.Extensions.UIBoundsExtension.ToRectangle(this.Bounds)); spriteBatch.DrawString(this.Text, this.Font, center, Color.White); }
public override void OnDraw(SpriteBatch spriteBatch) { //if (AnimationComplete) // return; if (this.IsMouseHoverState) { this.Pen.Color = Color.FromArgb((int)currentAlpha, 255, 255, 0); } else { this.Pen.Color = Color.FromArgb((int)currentAlpha, 255, 255, 255); } float x = (float)(this.Position.X + (double)(this.Size.Width / 2) - spriteBatch.MeasureString(this.Text, this.Font).X / 2.0); float y = (float)(this.Position.Y + (double)(this.Size.Height / 2) - spriteBatch.MeasureString(this.Text, this.Font).Y / 2.0); Vector2 center = new Vector2(x, y); spriteBatch.DrawRectangle(this.Pen, Sharpex2D.Common.Extensions.UIBoundsExtension.ToRectangle(this.Bounds)); spriteBatch.DrawString(this.Text, this.Font, center, Color.FromArgb((int)currentAlpha, 255, 255, 255)); }
/// <summary> /// Draws the DebugDisplay. /// </summary> /// <param name="spriteBatch">The spriteBatch.</param> /// <param name="gameTime">The GameTime.</param> public void Draw(SpriteBatch spriteBatch, GameTime gameTime) { if (!Visible) return; foreach (Enemy enemy in _currentEntityComposer.Enemies) { spriteBatch.DrawRectangle(_pen, enemy.Bounds); } foreach (Projectile projectile in _currentEntityComposer.Projectiles) { spriteBatch.DrawRectangle(_pen2, projectile.Bounds); } spriteBatch.DrawRectangle(_pen3, _currentEntityComposer.Player.Bounds); spriteBatch.DrawString(_debugMessage, _font, _display, Color.White); }