2
0

main.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #if MONOMAC
  2. using MonoMac.AppKit;
  3. using MonoMac.Foundation;
  4. #elif IPHONE
  5. using MonoTouch.Foundation;
  6. using MonoTouch.UIKit;
  7. #endif
  8. namespace MonoGame.Samples.VideoPlayer
  9. {
  10. #if MONOMAC
  11. class Program
  12. {
  13. static void Main (string[] args)
  14. {
  15. NSApplication.Init ();
  16. using (var p = new NSAutoreleasePool ()) {
  17. NSApplication.SharedApplication.Delegate = new AppDelegate ();
  18. // Set our Application Icon
  19. NSImage appIcon = NSImage.ImageNamed ("monogameicon.png");
  20. NSApplication.SharedApplication.ApplicationIconImage = appIcon;
  21. NSApplication.Main (args);
  22. }
  23. }
  24. }
  25. class AppDelegate : NSApplicationDelegate
  26. {
  27. private Game1 game;
  28. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  29. {
  30. game = new Game1();
  31. game.Run();
  32. }
  33. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  34. {
  35. return true;
  36. }
  37. }
  38. #elif IPHONE
  39. [Register("AppDelegate")]
  40. class Program : UIApplicationDelegate
  41. {
  42. private Game1 game;
  43. public override void FinishedLaunching (UIApplication app)
  44. {
  45. game = new Game1 ();
  46. game.Run ();
  47. }
  48. /// <summary>
  49. /// The main entry point for the application.
  50. /// </summary>
  51. static void Main (string[] args)
  52. {
  53. UIApplication.Main (args, null, "AppDelegate");
  54. }
  55. }
  56. #endif
  57. }