Program.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // Program.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #if MONOMAC
  10. using MonoMac.AppKit;
  11. using MonoMac.Foundation;
  12. #endif
  13. using System;
  14. namespace XnaGraphicsDemo
  15. {
  16. #if MONOMAC
  17. class Program
  18. {
  19. static void Main (string[] args)
  20. {
  21. NSApplication.Init ();
  22. using (var p = new NSAutoreleasePool ()) {
  23. NSApplication.SharedApplication.Delegate = new AppDelegate ();
  24. // Set our Application Icon
  25. //NSImage appIcon = NSImage.ImageNamed ("GameThumbnail.png");
  26. //NSApplication.SharedApplication.ApplicationIconImage = appIcon;
  27. NSApplication.Main (args);
  28. }
  29. }
  30. }
  31. class AppDelegate : NSApplicationDelegate
  32. {
  33. private DemoGame game;
  34. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  35. {
  36. game = new DemoGame();
  37. game.Run();
  38. }
  39. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  40. {
  41. return true;
  42. }
  43. }
  44. #else
  45. static class Program
  46. {
  47. /// <summary>
  48. /// The main entry point for the application.
  49. /// </summary>
  50. static void Main(string[] args)
  51. {
  52. using (DemoGame game = new DemoGame())
  53. {
  54. game.Run();
  55. }
  56. }
  57. }
  58. #endif
  59. }