Program.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #endif
  59. #endregion
  60. }