Program.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. using (PeerToPeerGame game = new PeerToPeerGame ()) {
  48. game.Run ();
  49. }
  50. }
  51. public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
  52. {
  53. return true;
  54. }
  55. }
  56. #elif IPHONE
  57. [Register ("AppDelegate")]
  58. class Program : UIApplicationDelegate
  59. {
  60. private PeerToPeerGame game;
  61. public override void FinishedLaunching (UIApplication app)
  62. {
  63. // Fun begins..
  64. game = new PeerToPeerGame();
  65. game.Run();
  66. }
  67. static void Main (string [] args)
  68. {
  69. UIApplication.Main (args,null,"AppDelegate");
  70. }
  71. }
  72. #else
  73. class Program
  74. {
  75. public static void Main(string[] args)
  76. {
  77. using ( PeerToPeer.PeerToPeerGame game = new PeerToPeer.PeerToPeerGame())
  78. {
  79. game.Run();
  80. }
  81. }
  82. }
  83. #endif
  84. #endregion
  85. }