Program.cs 1.6 KB

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