Program.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #region Using Statements
  2. using System;
  3. #if IPHONE
  4. using MonoTouch.Foundation;
  5. using MonoTouch.UIKit;
  6. using Microsoft.Xna;
  7. using Microsoft.Xna.Framework.Media;
  8. #elif MONOMAC
  9. #endif
  10. #endregion
  11. namespace GameStateManagement
  12. {
  13. #region Entry Point
  14. #if IPHONE
  15. [Register("AppDelegate")]
  16. class Program : UIApplicationDelegate
  17. {
  18. GameStateManagementGame game;
  19. public override void FinishedLaunching(UIApplication app)
  20. {
  21. // Fun begins..
  22. game = new GameStateManagementGame();
  23. game.Run();
  24. }
  25. /// <summary>
  26. /// The main entry point for the application.
  27. /// </summary>
  28. static void Main(string[] args)
  29. {
  30. UIApplication.Main(args, null, "AppDelegate");
  31. }
  32. }
  33. #elif MONOMAC
  34. static class Program
  35. {
  36. /// <summary>
  37. /// The main entry point for the application.
  38. /// </summary>
  39. static void Main (string[] args)
  40. {
  41. MonoMac.AppKit.NSApplication.Init ();
  42. using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
  43. MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
  44. MonoMac.AppKit.NSApplication.Main(args);
  45. }
  46. }
  47. }
  48. class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
  49. {
  50. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  51. {
  52. var game = new GameStateManagementGame();
  53. game.Run();
  54. }
  55. public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
  56. {
  57. return true;
  58. }
  59. }
  60. #else
  61. /// <summary>
  62. /// The main entry point for the application.
  63. /// </summary>
  64. static class Program
  65. {
  66. static void Main()
  67. {
  68. using (GameStateManagementGame game = new GameStateManagementGame())
  69. {
  70. game.Run();
  71. }
  72. }
  73. }
  74. #endif
  75. #endregion
  76. }