Program.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #region Using Statements
  10. using System;
  11. #if IPHONE
  12. using MonoTouch.Foundation;
  13. using MonoTouch.UIKit;
  14. #endif
  15. #endregion
  16. namespace CatapultGame
  17. {
  18. #if WINDOWS || XBOX || LINUX
  19. static class Program
  20. {
  21. /// <summary>
  22. /// The main entry point for the application.
  23. /// </summary>
  24. static void Main(string[] args)
  25. {
  26. using (CatapultGame game = new CatapultGame())
  27. {
  28. game.Run();
  29. }
  30. }
  31. }
  32. #elif MONOMAC
  33. static class Program
  34. {
  35. /// <summary>
  36. /// The main entry point for the application.
  37. /// </summary>
  38. static void Main (string[] args)
  39. {
  40. MonoMac.AppKit.NSApplication.Init ();
  41. using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
  42. MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
  43. MonoMac.AppKit.NSApplication.Main(args);
  44. }
  45. }
  46. }
  47. class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
  48. {
  49. CatapultGame game;
  50. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  51. {
  52. CatapultGame game = new CatapultGame();
  53. game.Run ();
  54. }
  55. public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
  56. {
  57. return true;
  58. }
  59. }
  60. #elif IPHONE
  61. [Register ("AppDelegate")]
  62. class Program : UIApplicationDelegate
  63. {
  64. private CatapultGame game;
  65. public override void FinishedLaunching (UIApplication app)
  66. {
  67. // Fun begins..
  68. game = new CatapultGame();
  69. game.Run();
  70. }
  71. // This is the main entry point of the application.
  72. static void Main (string[] args)
  73. {
  74. // if you want to use a different Application Delegate class from "AppDelegate"
  75. // you can specify it here.
  76. UIApplication.Main (args, null, "AppDelegate");
  77. }
  78. }
  79. #endif
  80. }