AlienGame.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //-----------------------------------------------------------------------------
  2. // AlienGame.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System;
  8. using Microsoft.Xna.Framework;
  9. using Microsoft.Xna.Framework.Graphics;
  10. namespace AlienGameSample
  11. {
  12. /// <summary>
  13. /// This is the main type for your game. All of the logic for the game is
  14. /// handled inside of a GameScreen, so Game1 is just used to setup the
  15. /// starting screens.
  16. /// </summary>
  17. public class AlienGame : Game
  18. {
  19. GraphicsDeviceManager graphics;
  20. ScreenManager screenManager;
  21. public AlienGame()
  22. {
  23. graphics = new GraphicsDeviceManager(this);
  24. Content.RootDirectory = "Content";
  25. screenManager = new ScreenManager(this);
  26. Components.Add(screenManager);
  27. // Zune use 30 frames per second
  28. this.TargetElapsedTime = TimeSpan.FromSeconds(1/30.0f);
  29. // The assets need to be stretched...put some quality
  30. graphics.PreferMultiSampling = true;
  31. // Add the background screen
  32. screenManager.AddScreen(new BackgroundScreen());
  33. // This loading screen pre-loads all content the game needs. It
  34. // doesn't draw anything, so the user sees the background screen
  35. // then the title and menus pop up.
  36. screenManager.AddScreen(new LoadingScreen());
  37. }
  38. }
  39. }