Program.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. #if MONOMAC
  5. using MonoMac.AppKit;
  6. using MonoMac.Foundation;
  7. #endif
  8. namespace Tetris
  9. {
  10. #if MONOMAC
  11. static class Program
  12. {
  13. /// <summary>
  14. /// The main entry point for the application.
  15. /// </summary>
  16. static void Main (string[] args)
  17. {
  18. NSApplication.Init ();
  19. using (var p = new NSAutoreleasePool ()) {
  20. NSApplication.SharedApplication.Delegate = new AppDelegate();
  21. NSApplication.Main(args);
  22. }
  23. }
  24. }
  25. class AppDelegate : NSApplicationDelegate
  26. {
  27. Engine game;
  28. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  29. {
  30. game = new Engine();
  31. game.Run();
  32. }
  33. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  34. {
  35. return true;
  36. }
  37. }
  38. #else
  39. static class Program
  40. {
  41. private static Engine game;
  42. /// <summary>
  43. /// The main entry point for the application.
  44. /// </summary>
  45. [STAThread]
  46. static void Main()
  47. {
  48. game = new Engine();
  49. game.Run();
  50. }
  51. }
  52. #endif
  53. }