Program.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // Program.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. #if MONOMAC
  12. using MonoMac.Foundation;
  13. using MonoMac.AppKit;
  14. using MonoMac.ObjCRuntime;
  15. #elif IPHONE
  16. using MonoTouch.Foundation;
  17. using MonoTouch.UIKit;
  18. #endif
  19. #endregion
  20. namespace RectangleCollision
  21. {
  22. #if MONOMAC
  23. static class Program
  24. {
  25. /// <summary>
  26. /// The main entry point for the application.
  27. /// </summary>
  28. static void Main (string[] args)
  29. {
  30. NSApplication.Init ();
  31. using (var p = new NSAutoreleasePool ()) {
  32. NSApplication.SharedApplication.Delegate = new AppDelegate();
  33. NSApplication.Main(args);
  34. }
  35. }
  36. }
  37. class AppDelegate : NSApplicationDelegate
  38. {
  39. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  40. {
  41. RectangleCollisionGame game = new RectangleCollisionGame ();
  42. game.Run ();
  43. }
  44. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  45. {
  46. return true;
  47. }
  48. }
  49. #elif IPHONE
  50. [Register ("AppDelegate")]
  51. class Program : UIApplicationDelegate
  52. {
  53. RectangleCollisionGame game;
  54. public override void FinishedLaunching (UIApplication app)
  55. {
  56. // Fun begins..
  57. game = new RectangleCollisionGame();
  58. game.Run();
  59. }
  60. static void Main (string [] args)
  61. {
  62. UIApplication.Main (args,null,"AppDelegate");
  63. }
  64. }
  65. #endif
  66. }