2
0

Program.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. using (RectangleCollisionGame game = new RectangleCollisionGame ()) {
  42. game.Run ();
  43. }
  44. }
  45. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  46. {
  47. return true;
  48. }
  49. }
  50. #elif IPHONE
  51. [Register ("AppDelegate")]
  52. class Program : UIApplicationDelegate
  53. {
  54. RectangleCollisionGame game;
  55. public override void FinishedLaunching (UIApplication app)
  56. {
  57. // Fun begins..
  58. game = new RectangleCollisionGame();
  59. game.Run();
  60. }
  61. static void Main (string [] args)
  62. {
  63. UIApplication.Main (args,null,"AppDelegate");
  64. }
  65. }
  66. #endif
  67. }