Program.cs 1.6 KB

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