CatapultGame.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // CatapultGame.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 Microsoft.Xna.Framework;
  14. using Microsoft.Xna.Framework.Audio;
  15. using Microsoft.Xna.Framework.Content;
  16. using Microsoft.Xna.Framework.GamerServices;
  17. using Microsoft.Xna.Framework.Graphics;
  18. using Microsoft.Xna.Framework.Input;
  19. using Microsoft.Xna.Framework.Input.Touch;
  20. using Microsoft.Xna.Framework.Media;
  21. using CatapultGame;
  22. using GameStateManagement;
  23. #endregion
  24. namespace CatapultGame
  25. {
  26. /// <summary>
  27. /// This is the main type for your game
  28. /// </summary>
  29. public class CatapultGame : Game
  30. {
  31. #region Fields
  32. GraphicsDeviceManager graphics;
  33. ScreenManager screenManager;
  34. #endregion
  35. #region Initialization Methods
  36. public CatapultGame()
  37. {
  38. graphics = new GraphicsDeviceManager(this);
  39. //graphics.SynchronizeWithVerticalRetrace = false;
  40. Content.RootDirectory = "Content";
  41. // Frame rate is 30 fps by default for Windows Phone.
  42. TargetElapsedTime = TimeSpan.FromTicks(333333);
  43. //Create a new instance of the Screen Manager
  44. screenManager = new ScreenManager(this);
  45. Components.Add(screenManager);
  46. IsMouseVisible = true;
  47. #if !WINDOWS && !XBOX && !MONOMAC
  48. //Switch to full screen for best game experience
  49. graphics.IsFullScreen = true;
  50. #endif
  51. //Add two new screens
  52. screenManager.AddScreen(new BackgroundScreen(), null);
  53. screenManager.AddScreen(new MainMenuScreen(), null);
  54. AudioManager.Initialize(this);
  55. }
  56. /// <summary>
  57. /// Allows the game to perform any initialization it needs to before starting to run.
  58. /// This is where it can query for any required services and load any non-graphic
  59. /// related content. Calling base.Initialize will enumerate through any components
  60. /// and initialize them as well.
  61. /// </summary>
  62. protected override void Initialize()
  63. {
  64. base.Initialize();
  65. }
  66. #endregion
  67. #region Loading
  68. protected override void LoadContent()
  69. {
  70. AudioManager.LoadSounds();
  71. base.LoadContent();
  72. }
  73. #endregion
  74. }
  75. }