BackgroundScreen.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // BackgroundScreen.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.Graphics;
  15. using Microsoft.Xna.Framework;
  16. using GameStateManagement;
  17. #endregion
  18. namespace CatapultGame
  19. {
  20. class BackgroundScreen : GameScreen
  21. {
  22. #region Fields
  23. Texture2D background;
  24. #endregion
  25. #region Initialization
  26. public BackgroundScreen()
  27. {
  28. TransitionOnTime = TimeSpan.FromSeconds(0.0);
  29. TransitionOffTime = TimeSpan.FromSeconds(0.5);
  30. }
  31. #endregion
  32. #region Loading
  33. public override void LoadContent()
  34. {
  35. background = Load<Texture2D>("Textures/Backgrounds/title_screen");
  36. }
  37. #endregion
  38. #region Render
  39. public override void Draw(GameTime gameTime)
  40. {
  41. SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
  42. spriteBatch.Begin();
  43. // Draw Background
  44. spriteBatch.Draw(background, new Vector2(0, 0),
  45. new Color(255, 255, 255, TransitionAlpha));
  46. spriteBatch.End();
  47. }
  48. #endregion
  49. }
  50. }