Browse Source

Fix samples to run with new model by not using the using clause

Kenneth Pouncey 13 years ago
parent
commit
8d652763dc

+ 4 - 4
Samples/MacOS/CatapaultWars/Program.cs

@@ -48,12 +48,12 @@ namespace CatapultGame
 	
 	
 	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
 	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
 	{
 	{
-		
+		CatapultGame game;
 		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
 		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
 		{
 		{
-			using (CatapultGame game = new CatapultGame()) {
-				game.Run ();
-			}
+			CatapultGame game = new CatapultGame();
+			game.Run ();
+
 		}
 		}
 		
 		
 		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
 		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)

+ 3 - 4
Samples/MacOS/CatapultNetWars/Program.cs

@@ -48,12 +48,11 @@ namespace CatapultGame
 	
 	
 	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
 	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
 	{
 	{
-		
+		CatapultGame game;
 		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
 		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
 		{
 		{
-			using (CatapultGame game = new CatapultGame()) {
-				game.Run ();
-			}
+			CatapultGame game = new CatapultGame();
+			game.Run ();
 		}
 		}
 		
 		
 		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
 		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)

+ 3 - 4
Samples/MacOS/InputReporter/Program.cs

@@ -19,12 +19,11 @@ namespace InputReporter
 	
 	
 	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
 	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
 	{
 	{
-		
+		InputReporterGame game;
 		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
 		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
 		{
 		{
-			using (InputReporterGame game = new InputReporterGame()) {
-				game.Run ();
-			}
+			game = new InputReporterGame();
+			game.Run ();
 		}
 		}
 		
 		
 		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
 		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)

+ 1 - 1
Samples/MacOS/ParticleSample/Program.cs

@@ -1 +1 @@
-
using System;


namespace ParticleSample
{

	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main (string[] args)
		{
			MonoMac.AppKit.NSApplication.Init ();
			
			using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
				MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
				MonoMac.AppKit.NSApplication.Main(args);
			}
		}
	}
	
	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
	{
		
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
			using (ParticleSampleGame game = new ParticleSampleGame()) {
				game.Run ();
			}
		}
		
		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
		{
			return true;
		}
	}


}

+
using System;


namespace ParticleSample
{

	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main (string[] args)
		{
			MonoMac.AppKit.NSApplication.Init ();
			
			using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
				MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
				MonoMac.AppKit.NSApplication.Main(args);
			}
		}
	}
	
	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
	{
		ParticleSampleGame game;
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{

			game = new ParticleSampleGame();
			game.Run ();

		}
		
		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
		{
			return true;
		}
	}


}


+ 1 - 1
Samples/MacOS/StarWarrior/Program.cs

@@ -1 +1 @@
-using System;

namespace StarWarrior
{

	static class Program
	{	
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main (string[] args)
		{
			MonoMac.AppKit.NSApplication.Init ();
			
			using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
				MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
				MonoMac.AppKit.NSApplication.Main(args);
			}
		}
	}
	
	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
	{
		
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
			using (Game1 game = new Game1()) {
				game.Run ();
			}
		}
		
		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
		{
			return true;
		}
	}

}

+using System;

namespace StarWarrior
{

	static class Program
	{	
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main (string[] args)
		{
			MonoMac.AppKit.NSApplication.Init ();
			
			using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
				MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
				MonoMac.AppKit.NSApplication.Main(args);
			}
		}
	}
	
	class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
	{
		Game1 game;
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
			game = new Game1();
			game.Run ();
			
		}
		
		public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
		{
			return true;
		}
	}

}


+ 2 - 1
Samples/MacOS/Tetris/Engine.cs

@@ -64,7 +64,8 @@ namespace Tetris
 
 
 			graphics.PreferredBackBufferHeight = 600;
 			graphics.PreferredBackBufferHeight = 600;
 			graphics.PreferredBackBufferWidth = 800;
 			graphics.PreferredBackBufferWidth = 800;
-
+			graphics.ApplyChanges();
+			
 			this.TargetElapsedTime = TimeSpan.FromSeconds (1.0f / 10.0f);
 			this.TargetElapsedTime = TimeSpan.FromSeconds (1.0f / 10.0f);
 
 
 			// Try to open file if it exists, otherwise create it
 			// Try to open file if it exists, otherwise create it

+ 2 - 0
StarterKits/MacOS/VectorRumble/Screens/MessageBoxScreen.cs

@@ -99,6 +99,7 @@ namespace VectorRumble
 
 
                 ExitScreen();
                 ExitScreen();
             }
             }
+#if ANDROID
 			foreach (var g in input.Gestures)
 			foreach (var g in input.Gestures)
 			{
 			{
 				if (g.GestureType == GestureType.Tap)
 				if (g.GestureType == GestureType.Tap)
@@ -108,6 +109,7 @@ namespace VectorRumble
 					ExitScreen();
 					ExitScreen();
 				}
 				}
 			}
 			}
+#endif			
         }
         }