Label.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #region File Information
  2. //-----------------------------------------------------------------------------
  3. // Label.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using Microsoft.Xna.Framework;
  15. using Microsoft.Xna.Framework.Graphics;
  16. #endregion
  17. namespace DynamicMenu.Controls
  18. {
  19. /// <summary>
  20. /// A simple control which shows text centered in its bounds
  21. /// </summary>
  22. public class Label : TextControl
  23. {
  24. /// <summary>
  25. /// Draws the control, called once per frame
  26. /// </summary>
  27. /// <param name="gameTime">The current game time</param>
  28. /// <param name="spriteBatch">The sprite batch to draw with</param>
  29. public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
  30. {
  31. base.Draw(gameTime, spriteBatch);
  32. DrawCenteredText(spriteBatch, Font, GetAbsoluteRect(), Text, TextColor);
  33. }
  34. }
  35. }