Program.cs 1.6 KB

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