Program.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #else
  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. #else
  62. /// <summary>
  63. /// The main entry point for the application.
  64. /// </summary>
  65. static class Program
  66. {
  67. static void Main()
  68. {
  69. using (GameStateManagementGame game = new GameStateManagementGame())
  70. {
  71. game.Run();
  72. }
  73. }
  74. }
  75. #endif
  76. #endregion
  77. }