Program.cs 1.6 KB

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