SampleGame.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //-----------------------------------------------------------------------------
  2. // SampleGame.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.GamerServices;
  10. using Microsoft.Xna.Framework.Graphics;
  11. namespace UserInterfaceSample
  12. {
  13. public class SampleGame : Microsoft.Xna.Framework.Game
  14. {
  15. GraphicsDeviceManager graphics;
  16. ScreenManager screenManager;
  17. public SampleGame()
  18. {
  19. graphics = new GraphicsDeviceManager(this);
  20. Content.RootDirectory = "Content";
  21. // Frame rate is 30 fps by default for Windows Phone.
  22. TargetElapsedTime = TimeSpan.FromTicks(333333);
  23. // Disable the status bar
  24. graphics.IsFullScreen = true;
  25. screenManager = new ScreenManager(this);
  26. Components.Add(screenManager);
  27. // attempt to deserialize the screen manager from disk. if that fails, we add our default screens.
  28. if (!screenManager.DeserializeState())
  29. {
  30. // Activate the first screens.
  31. screenManager.AddScreen(new BackgroundScreen(), null);
  32. screenManager.AddScreen(new MainMenuScreen(), null);
  33. }
  34. }
  35. protected override void Draw(GameTime gameTime)
  36. {
  37. GraphicsDevice.Clear(Color.Black);
  38. base.Draw(gameTime);
  39. }
  40. }
  41. }