BackgroundScreen.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //-----------------------------------------------------------------------------
  2. // BackgroundScreen.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using Microsoft.Xna.Framework.Graphics;
  12. using Microsoft.Xna.Framework;
  13. using GameStateManagement;
  14. namespace CatapultGame
  15. {
  16. class BackgroundScreen : GameScreen
  17. {
  18. Texture2D background;
  19. public BackgroundScreen()
  20. {
  21. TransitionOnTime = TimeSpan.FromSeconds(0.0);
  22. TransitionOffTime = TimeSpan.FromSeconds(0.5);
  23. }
  24. public override void LoadContent()
  25. {
  26. background = Load<Texture2D>("Textures/Backgrounds/title_screen");
  27. }
  28. public override void Draw(GameTime gameTime)
  29. {
  30. SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
  31. spriteBatch.Begin();
  32. // Draw Background
  33. spriteBatch.Draw(background, new Vector2(0, 0),
  34. new Color(255, 255, 255, TransitionAlpha));
  35. spriteBatch.End();
  36. }
  37. }
  38. }