Răsfoiți Sursa

change to allow GameStateManagement to work on Mac.

Dominique Louis 13 ani în urmă
părinte
comite
cef84a31e5
1 a modificat fișierele cu 35 adăugiri și 2 ștergeri
  1. 35 2
      GameStateManagement/Program.cs

+ 35 - 2
GameStateManagement/Program.cs

@@ -1,6 +1,9 @@
 #region Using Statements
 using System;
-#if IPHONE
+#if MONOMAC
+using MonoMac.AppKit;
+using MonoMac.Foundation;
+#elif IPHONE
 using MonoTouch.Foundation;
 using MonoTouch.UIKit;
 using Microsoft.Xna;
@@ -12,7 +15,37 @@ using Microsoft.Xna.Framework.Media;
 namespace GameStateManagement
 {
     #region Entry Point
-#if IPHONE
+#if MONOMAC
+	class Program
+	{
+		static void Main (string[] args)
+		{
+			NSApplication.Init ();
+
+			using (var p = new NSAutoreleasePool ()) {
+				NSApplication.SharedApplication.Delegate = new AppDelegate ();			
+
+				NSApplication.Main (args);
+			}
+		}
+	}
+
+	class AppDelegate : NSApplicationDelegate
+	{
+		private GameStateManagementGame game;
+
+		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+		{
+			game = new GameStateManagementGame ();
+			game.Run();
+		}
+
+		public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
+		{
+			return true;
+		}
+	}
+#elif IPHONE
     [Register("AppDelegate")]
     class Program : UIApplicationDelegate
     {