Program.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // PeerToPeerGame.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. using Microsoft.Xna.Framework;
  12. using Microsoft.Xna.Framework.GamerServices;
  13. using Microsoft.Xna.Framework.Graphics;
  14. using Microsoft.Xna.Framework.Input;
  15. using Microsoft.Xna.Framework.Net;
  16. #if MONOMAC
  17. using MonoMac.Foundation;
  18. using MonoMac.AppKit;
  19. using MonoMac.ObjCRuntime;
  20. #elif IPHONE
  21. using MonoTouch.Foundation;
  22. using MonoTouch.UIKit;
  23. #endif
  24. #endregion
  25. namespace PeerToPeer
  26. {
  27. #region Entry Point
  28. #if MONOMAC
  29. static class Program
  30. {
  31. /// <summary>
  32. /// The main entry point for the application.
  33. /// </summary>
  34. static void Main (string[] args)
  35. {
  36. NSApplication.Init ();
  37. using (var p = new NSAutoreleasePool ()) {
  38. NSApplication.SharedApplication.Delegate = new AppDelegate();
  39. NSApplication.Main(args);
  40. }
  41. }
  42. }
  43. class AppDelegate : NSApplicationDelegate
  44. {
  45. public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
  46. {
  47. PeerToPeerGame game = new PeerToPeerGame ();
  48. game.Run ();
  49. }
  50. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  51. {
  52. return true;
  53. }
  54. }
  55. #elif IPHONE
  56. [Register ("AppDelegate")]
  57. class Program : UIApplicationDelegate
  58. {
  59. private PeerToPeerGame game;
  60. public override void FinishedLaunching (UIApplication app)
  61. {
  62. // Fun begins..
  63. game = new PeerToPeerGame();
  64. game.Run();
  65. }
  66. static void Main (string [] args)
  67. {
  68. UIApplication.Main (args,null,"AppDelegate");
  69. }
  70. }
  71. #else
  72. class Program
  73. {
  74. public static void Main(string[] args)
  75. {
  76. using ( PeerToPeer.PeerToPeerGame game = new PeerToPeer.PeerToPeerGame())
  77. {
  78. game.Run();
  79. }
  80. }
  81. }
  82. #endif
  83. #endregion
  84. }