Program.cs 2.6 KB

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