CatapultGame.cs 2.5 KB

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