diff --git a/Audio3D/Audio3D.MacOS.csproj b/Audio3D/Audio3D.MacOS.csproj
index 10361b3d..1ce99e91 100644
--- a/Audio3D/Audio3D.MacOS.csproj
+++ b/Audio3D/Audio3D.MacOS.csproj
@@ -6,10 +6,13 @@
10.0.0
2.0
{D5C989FD-6AE3-417F-BCB9-7AE30F195A31}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
Audio3D
Audio3D
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -63,8 +66,10 @@
-
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -79,9 +84,10 @@
+
-
-
+
+
@@ -94,14 +100,5 @@
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
\ No newline at end of file
diff --git a/Audio3D/Info.plist b/Audio3D/Info.plist
index f3e06a36..eecf9e7b 100644
--- a/Audio3D/Info.plist
+++ b/Audio3D/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/Audio3D/Main.cs b/Audio3D/Main.cs
index 3bfe3566..c23a1338 100644
--- a/Audio3D/Main.cs
+++ b/Audio3D/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace Audio3D
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
Audio3DGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Audio3DGame ();
game.Run ();
diff --git a/Audio3D/packages.config b/Audio3D/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/Audio3D/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BackgroundThreadTester/BackgroundThreadTester.MacOS.csproj b/BackgroundThreadTester/BackgroundThreadTester.MacOS.csproj
index aacb5219..8c54c131 100644
--- a/BackgroundThreadTester/BackgroundThreadTester.MacOS.csproj
+++ b/BackgroundThreadTester/BackgroundThreadTester.MacOS.csproj
@@ -6,10 +6,13 @@
10.0.0
2.0
{8592FA21-37B6-41C8-BC7F-17EB4930B96A}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
BackgroundThreadTester
BackgroundThreadTester
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -46,18 +49,21 @@
-
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
+
-
-
+
+
@@ -78,14 +84,5 @@
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
diff --git a/BackgroundThreadTester/Game1.cs b/BackgroundThreadTester/Game1.cs
index fc6cee38..fe28696b 100644
--- a/BackgroundThreadTester/Game1.cs
+++ b/BackgroundThreadTester/Game1.cs
@@ -4,16 +4,14 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
-using System.Windows.Forms;
using System.Threading;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
-
+using AppKit;
+using Foundation;
+
namespace BackgroundThreadTester
{
public class Game1 : Microsoft.Xna.Framework.Game
@@ -65,9 +63,9 @@ protected override void UnloadContent ()
public void CreateBackgroundThread ()
{
- System.Console.WriteLine ("before invoke");
- // create a new thread using BackgroundWorkerThread as method to execute
- var thread = new Thread (BackgroundWorkerThread as ThreadStart);
+ System.Console.WriteLine ("before invoke");
+ // create a new thread using BackgroundWorkerThread as method to execute
+ var thread = new Thread (BackgroundWorkerThread);
// start it
thread.Start ();
@@ -86,7 +84,7 @@ void BackgroundWorkerThread ()
Console.WriteLine ("Before add");
// Make sure we invoke this on the Main Thread or OpenGL will throw an error
- MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
+ AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
Components.Add (new TestTexture (this));
});
Console.WriteLine ("After add");
@@ -112,7 +110,7 @@ public int GetBackBufferHeight ()
public String GetStyleMask ()
{
- return this.Window.Window.StyleMask.ToString ();
+ return this.Window.ToString (); // TODO
}//GetStyleMask
@@ -183,13 +181,13 @@ public void CenterWindow ()
fNewX = (fScreenWidth - fWindowWidth) / 2;
fNewY = (fScreenHeight - fWindowHeight) / 2;
- fTitleBarHeight = this.Window.Window.Frame.Height - fWindowHeight;
+ fTitleBarHeight = this.Window.Frame.Height - fWindowHeight;
System.Drawing.PointF pfLocation = new System.Drawing.PointF (fNewX, fNewY);
System.Drawing.PointF pfSize = new System.Drawing.PointF (fWindowWidth, fWindowHeight + fTitleBarHeight);
System.Drawing.SizeF sfSize = new System.Drawing.SizeF (pfSize);
System.Drawing.RectangleF rectTemp = new System.Drawing.RectangleF (pfLocation, sfSize);
- this.Window.Window.SetFrame (rectTemp, true);
+ this.Window.SetFrame (rectTemp, true);
}//CenterWindow
}
}
diff --git a/BackgroundThreadTester/Info.plist b/BackgroundThreadTester/Info.plist
index 0457f7b3..df22f7c2 100644
--- a/BackgroundThreadTester/Info.plist
+++ b/BackgroundThreadTester/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSMainNibFile
MainMenu
NSPrincipalClass
diff --git a/BackgroundThreadTester/InputManager.cs b/BackgroundThreadTester/InputManager.cs
index 6f54c32a..faed4964 100644
--- a/BackgroundThreadTester/InputManager.cs
+++ b/BackgroundThreadTester/InputManager.cs
@@ -4,11 +4,8 @@
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Net;
-using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Media;
using System.IO;
-using Microsoft.Xna.Framework.GamerServices;
namespace BackgroundThreadTester
{
diff --git a/BackgroundThreadTester/Object.cs b/BackgroundThreadTester/Object.cs
index dcb3ae92..96f59913 100644
--- a/BackgroundThreadTester/Object.cs
+++ b/BackgroundThreadTester/Object.cs
@@ -4,12 +4,9 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
-using Microsoft.Xna.Framework.Net;
-using Microsoft.Xna.Framework.Storage;
namespace BackgroundThreadTester
@@ -66,7 +63,7 @@ public override void Draw(GameTime gameTime)
// Get the current spritebatch
SpriteBatch sBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
- sBatch.Draw(texture, v2Temp, recCurrentFrame, new Color(255, 255, 255, (byte)nAlpha), fRotation, vecRotationCenter, 1f, SpriteEffects.None, 0);
+ sBatch.Draw (texture, v2Temp, recCurrentFrame, new Color ((byte)255, (byte)255, (byte)255, (byte)nAlpha), fRotation, vecRotationCenter, 1f, SpriteEffects.None, 0);
base.Draw(gameTime);
}
diff --git a/BackgroundThreadTester/Program.cs b/BackgroundThreadTester/Program.cs
index bc27836c..aa2f6348 100644
--- a/BackgroundThreadTester/Program.cs
+++ b/BackgroundThreadTester/Program.cs
@@ -1,5 +1,5 @@
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace BackgroundThreadTester
@@ -22,7 +22,7 @@ class AppDelegate : NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/BackgroundThreadTester/TextManager.cs b/BackgroundThreadTester/TextManager.cs
index b6a6a86e..fb802f69 100644
--- a/BackgroundThreadTester/TextManager.cs
+++ b/BackgroundThreadTester/TextManager.cs
@@ -4,12 +4,9 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
-using Microsoft.Xna.Framework.Net;
-using Microsoft.Xna.Framework.Storage;
namespace BackgroundThreadTester
{
public class TextManager : Microsoft.Xna.Framework.DrawableGameComponent
diff --git a/BackgroundThreadTester/packages.config b/BackgroundThreadTester/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/BackgroundThreadTester/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BloomSample/BloomComponent.cs b/BloomSample/BloomComponent.cs
index f3bfffe3..418161dd 100755
--- a/BloomSample/BloomComponent.cs
+++ b/BloomSample/BloomComponent.cs
@@ -70,7 +70,7 @@ public BloomComponent(Game game)
: base(game)
{
if (game == null)
- throw new ArgumentNullException("game");
+ throw new ArgumentNullException(nameof (game));
}
diff --git a/BloomSample/BloomSample.MacOS.csproj b/BloomSample/BloomSample.MacOS.csproj
index 52bae4e0..63a215fc 100644
--- a/BloomSample/BloomSample.MacOS.csproj
+++ b/BloomSample/BloomSample.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{A93553D9-11E5-4B0B-9809-4E4765D5FD8F}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
BloomSample
BloomSample
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -63,8 +67,10 @@
-
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -75,9 +81,10 @@
+
-
-
+
+
@@ -115,14 +122,5 @@
PreserveNewest
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
\ No newline at end of file
diff --git a/BloomSample/Info.plist b/BloomSample/Info.plist
index c721bcf9..7b0ebf01 100644
--- a/BloomSample/Info.plist
+++ b/BloomSample/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/BloomSample/Main.cs b/BloomSample/Main.cs
index c357a758..4d831c3a 100644
--- a/BloomSample/Main.cs
+++ b/BloomSample/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace BloomPostprocess
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
BloomPostprocessGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new BloomPostprocessGame ();
game.Run ();
diff --git a/BloomSample/packages.config b/BloomSample/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/BloomSample/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.MacOS.csproj b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.MacOS.csproj
index 8a1d3d43..cc7ac1a7 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.MacOS.csproj
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/AsteroidBeltAssault.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{1585306B-CF46-479D-B234-1E10EDF4D741}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
AsteroidBeltAssault
AsteroidBeltAssault
True
+ v2.0
+ Xamarin.Mac
True
@@ -46,8 +49,10 @@
-
-
+
+
+ ..\..\..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -55,9 +60,10 @@
+
-
-
+
+
@@ -87,14 +93,5 @@
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game1.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game1.cs
index e1009fd4..c64c547a 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game1.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Game1.cs
@@ -4,7 +4,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Info.plist b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Info.plist
index 239e48ae..2b0c64e9 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Info.plist
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Program.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Program.cs
index 10fb116a..ff9a18c4 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Program.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/Program.cs
@@ -1,9 +1,9 @@
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endif
namespace Asteroid_Belt_Assault
@@ -22,7 +22,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -42,7 +42,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/packages.config b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/AsteroidBeltAssault/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.MacOS.csproj b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.MacOS.csproj
index 892458b4..c2180e7a 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.MacOS.csproj
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/FloodControl.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{F3115910-E6D1-450D-97FB-A8168A5D622E}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
FloodControl
FloodControl
True
+ v2.0
+ Xamarin.Mac
True
@@ -46,8 +49,10 @@
-
-
+
+
+ ..\..\..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -55,9 +60,10 @@
+
-
-
+
+
@@ -77,14 +83,5 @@
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game1.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game1.cs
index 4407878d..d30e469c 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game1.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Game1.cs
@@ -4,7 +4,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Info.plist b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Info.plist
index 3cd36704..211236be 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Info.plist
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Program.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Program.cs
index b3470580..41d92fe6 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Program.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/Program.cs
@@ -1,9 +1,9 @@
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endif
namespace Flood_Control
@@ -22,7 +22,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -42,7 +42,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/packages.config b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/FloodControl/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game1.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game1.cs
index 468777a4..cdf5e51f 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game1.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Game1.cs
@@ -4,7 +4,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.MacOS.csproj b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.MacOS.csproj
index 71a14f21..f7226fe2 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.MacOS.csproj
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/GemstoneHunter.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{81313197-A8DF-4465-B503-2DD8248B80A9}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
GemstoneHunter
GemstoneHunter
True
+ v2.0
+ Xamarin.Mac
True
@@ -46,8 +49,10 @@
-
-
+
+
+ ..\..\..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -55,22 +60,15 @@
+
-
-
+
+
{521972FD-1A9B-4CFD-A435-EB2224985131}
Tile Engine.MacOS
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
@@ -112,4 +110,5 @@
+
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Info.plist b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Info.plist
index c8258736..d8604c93 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Info.plist
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/LevelManager.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/LevelManager.cs
index a6ddd9f7..1cc4f396 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/LevelManager.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/LevelManager.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Program.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Program.cs
index 987310ce..6388d78e 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Program.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/Program.cs
@@ -1,9 +1,9 @@
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endif
namespace Gemstone_Hunter
@@ -22,7 +22,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -42,7 +42,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.MacOS.csproj b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.MacOS.csproj
index 5d34971e..bd0950be 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.MacOS.csproj
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/Tile Engine.MacOS.csproj
@@ -32,24 +32,19 @@
+
+ ..\..\..\..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\net45\MonoGame.Framework.dll
+
-
+
+
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
+
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/TileMap.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/TileMap.cs
index 345d96a0..4c15806a 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/TileMap.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/TileMap.cs
@@ -4,11 +4,9 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
-using Microsoft.Xna.Framework.Storage;
using System.IO;
using System.Xml.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/packages.config b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/packages.config
new file mode 100644
index 00000000..f5ef1957
--- /dev/null
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/TileEngine/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/packages.config b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/GemstoneHunter/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Game1.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Game1.cs
index 33ecf230..cc00143a 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Game1.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Game1.cs
@@ -4,7 +4,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Info.plist b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Info.plist
index a33ed0b9..1b88b0e6 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Info.plist
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Program.cs b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Program.cs
index 77206b0d..74b6f331 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Program.cs
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/Program.cs
@@ -1,9 +1,9 @@
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endif
namespace Robot_Rampage
@@ -22,7 +22,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -42,7 +42,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
Game1 game = new Game1 ();
game.Run ();
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/RobotRampage.MacOS.csproj b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/RobotRampage.MacOS.csproj
index 73f2999c..ebef9ec2 100644
--- a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/RobotRampage.MacOS.csproj
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/RobotRampage.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{9522776F-02BA-4BED-B8BB-6BAE580F4068}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
RobotRampage
RobotRampage
True
+ v2.0
+ Xamarin.Mac
True
@@ -46,8 +49,10 @@
-
-
+
+
+ ..\..\..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -55,9 +60,10 @@
+
-
-
+
+
@@ -84,14 +90,5 @@
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
diff --git a/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/packages.config b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/BookSourceCode/XNAGameDevelopmentbyExampleCode/RobotRampage/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BouncingBox/BouncingBox.MacOS.csproj b/BouncingBox/BouncingBox.MacOS.csproj
index 3854cfd5..25c6d1c4 100644
--- a/BouncingBox/BouncingBox.MacOS.csproj
+++ b/BouncingBox/BouncingBox.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{4480BF44-7CE2-4A22-9372-DAFA3B05390E}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
Microsoft.Xna.Samples.BouncingBox.MacOS
Microsoft.Xna.Samples.BouncingBox.MacOS
True
+ v2.0
+ Xamarin.Mac
True
diff --git a/BouncingBox/main.cs b/BouncingBox/main.cs
index b52d3da2..29b41cb8 100644
--- a/BouncingBox/main.cs
+++ b/BouncingBox/main.cs
@@ -1,6 +1,6 @@
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -8,7 +8,7 @@
namespace Microsoft.Xna.Samples.BouncingBox
{
-#if MONOMAC
+#if __MACOS__
class Program
{
static void Main (string[] args)
@@ -31,7 +31,7 @@ class AppDelegate : NSApplicationDelegate
{
private Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1 ();
game.Run();
diff --git a/CatapaultWars/CatapaultGame.MacOS.csproj b/CatapaultWars/CatapaultGame.MacOS.csproj
index 898005db..200d8be2 100644
--- a/CatapaultWars/CatapaultGame.MacOS.csproj
+++ b/CatapaultWars/CatapaultGame.MacOS.csproj
@@ -6,10 +6,13 @@
10.0.0
2.0
{1F4BF77D-34DA-417D-96DE-24213A05729B}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
CatapaultGame
Catapault
+ True
+ v2.0
+ Xamarin.Mac
True
diff --git a/CatapaultWars/Catapult/Catapult.cs b/CatapaultWars/Catapult/Catapult.cs
index a46ff93a..7b248abf 100644
--- a/CatapaultWars/Catapult/Catapult.cs
+++ b/CatapaultWars/Catapult/Catapult.cs
@@ -267,7 +267,7 @@ public override void Update(GameTime gameTime)
CatapultState postUpdateStateChange = 0;
if (gameTime == null)
- throw new ArgumentNullException("gameTime");
+ throw new ArgumentNullException(nameof (gameTime));
// The catapult is inactive, so there is nothing to update
if (!IsActive)
@@ -463,7 +463,7 @@ private void StartFiringFromLastAimPosition()
public override void Draw(GameTime gameTime)
{
if (gameTime == null)
- throw new ArgumentNullException("gameTime");
+ throw new ArgumentNullException(nameof (gameTime));
// Using the last update state makes sure we do not draw
// before updating animations properly
diff --git a/CatapaultWars/CatapultGame.cs b/CatapaultWars/CatapultGame.cs
index 3ffbe42c..a976dd30 100644
--- a/CatapaultWars/CatapultGame.cs
+++ b/CatapaultWars/CatapultGame.cs
@@ -49,7 +49,7 @@ public CatapultGame()
screenManager = new ScreenManager(this);
Components.Add(screenManager);
IsMouseVisible = true;
-#if !WINDOWS && !XBOX && !MONOMAC
+#if !WINDOWS && !XBOX && !__MACOS__
//Switch to full screen for best game experience
graphics.IsFullScreen = true;
#endif
diff --git a/CatapaultWars/Program.cs b/CatapaultWars/Program.cs
index 20936b34..86449aab 100644
--- a/CatapaultWars/Program.cs
+++ b/CatapaultWars/Program.cs
@@ -33,7 +33,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
@@ -43,26 +43,26 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
CatapultGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
CatapultGame game = new CatapultGame();
game.Run ();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/CatapaultWars/Screens/InstructionsScreen.cs b/CatapaultWars/Screens/InstructionsScreen.cs
index 084acabe..f4973a19 100644
--- a/CatapaultWars/Screens/InstructionsScreen.cs
+++ b/CatapaultWars/Screens/InstructionsScreen.cs
@@ -19,9 +19,9 @@
using GameStateManagement;
using Microsoft.Xna.Framework.Input.Touch;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
#if IPHONE
@@ -100,7 +100,7 @@ public override void HandleInput (InputState input)
gameplayScreen.ScreenManager = ScreenManager;
// Start loading the resources in additional thread
-#if MONOMAC
+#if __MACOS__
// create a new thread using BackgroundWorkerThread as method to execute
thread = new Thread (LoadAssetsWorkerThread as ThreadStart);
#else
@@ -136,22 +136,22 @@ public override void HandleInput (InputState input)
void LoadAssetsWorkerThread ()
{
-#if MONOMAC || IPHONE
+#if __MACOS__ || IPHONE
// Create an Autorelease Pool or we will leak objects.
using (var pool = new NSAutoreleasePool()) {
#else
#endif
// Make sure we invoke this on the Main Thread or OpenGL will throw an error
-#if MONOMAC
- MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
+#if __MACOS__
+ AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
#endif
#if IPHONE
var invokeOnMainThredObj = new NSObject();
invokeOnMainThredObj.InvokeOnMainThread(delegate {
#endif
gameplayScreen.LoadAssets ();
-#if MONOMAC || IPHONE
+#if __MACOS__ || IPHONE
});
}
diff --git a/CatapultNetWars/Catapult/Catapult.cs b/CatapultNetWars/Catapult/Catapult.cs
index a947876b..dbbdde3a 100644
--- a/CatapultNetWars/Catapult/Catapult.cs
+++ b/CatapultNetWars/Catapult/Catapult.cs
@@ -267,7 +267,7 @@ public override void Update(GameTime gameTime)
CatapultState postUpdateStateChange = 0;
if (gameTime == null)
- throw new ArgumentNullException("gameTime");
+ throw new ArgumentNullException(nameof (gameTime));
// The catapult is inactive, so there is nothing to update
if (!IsActive)
@@ -463,7 +463,7 @@ private void StartFiringFromLastAimPosition()
public override void Draw(GameTime gameTime)
{
if (gameTime == null)
- throw new ArgumentNullException("gameTime");
+ throw new ArgumentNullException(nameof (gameTime));
// Using the last update state makes sure we do not draw
// before updating animations properly
diff --git a/CatapultNetWars/CatapultGame.cs b/CatapultNetWars/CatapultGame.cs
index 0cb5d8a7..313a93fc 100644
--- a/CatapultNetWars/CatapultGame.cs
+++ b/CatapultNetWars/CatapultGame.cs
@@ -75,7 +75,7 @@ public CatapultGame ()
NetworkSession.InviteAccepted += (sender, e) => NetworkSessionComponent.InviteAccepted (screenManager, e);
IsMouseVisible = true;
-#if !WINDOWS && !XBOX && !MONOMAC && !LINUX
+#if !WINDOWS && !XBOX && !__MACOS__ && !LINUX
//Switch to full screen for best game experience
graphics.IsFullScreen = true;
#else
diff --git a/CatapultNetWars/CatapultNetWars.MacOS.csproj b/CatapultNetWars/CatapultNetWars.MacOS.csproj
index ca500422..c566afc9 100644
--- a/CatapultNetWars/CatapultNetWars.MacOS.csproj
+++ b/CatapultNetWars/CatapultNetWars.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
x86
10.0.0
2.0
{1F4BF87D-34DA-417D-96DE-24213A05739B}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
CatapultGame
Catapault
+ True
+ v2.0
+ Xamarin.Mac
True
diff --git a/CatapultNetWars/Program.cs b/CatapultNetWars/Program.cs
index 8dd93173..bb45a811 100644
--- a/CatapultNetWars/Program.cs
+++ b/CatapultNetWars/Program.cs
@@ -33,7 +33,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -41,25 +41,25 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
CatapultGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
CatapultGame game = new CatapultGame();
game.Run ();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/CatapultNetWars/Screens/InstructionsScreen.cs b/CatapultNetWars/Screens/InstructionsScreen.cs
index ada71db3..5164d725 100644
--- a/CatapultNetWars/Screens/InstructionsScreen.cs
+++ b/CatapultNetWars/Screens/InstructionsScreen.cs
@@ -19,9 +19,9 @@
using GameStateManagement;
using Microsoft.Xna.Framework.Input.Touch;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
#if IPHONE
@@ -104,7 +104,7 @@ public override void HandleInput (InputState input)
// Start loading the resources in additional thread
#if !LINUX && !WINDOWS
-#if MONOMAC
+#if __MACOS__
// create a new thread using BackgroundWorkerThread as method to execute
thread = new Thread (LoadAssetsWorkerThread as ThreadStart);
#else
@@ -142,22 +142,22 @@ void LoadAssetsWorkerThread ()
{
-#if MONOMAC || IPHONE
+#if __MACOS__ || IPHONE
// Create an Autorelease Pool or we will leak objects.
using (var pool = new NSAutoreleasePool()) {
#else
#endif
// Make sure we invoke this on the Main Thread or OpenGL will throw an error
-#if MONOMAC
- MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
+#if __MACOS__
+ AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
#endif
#if IPHONE
var invokeOnMainThredObj = new NSObject();
invokeOnMainThredObj.InvokeOnMainThread(delegate {
#endif
gameplayScreen.LoadAssets ();
-#if MONOMAC || IPHONE
+#if __MACOS__ || IPHONE
});
}
diff --git a/ChaseAndEvade/ChaseAndEvade.MacOS.csproj b/ChaseAndEvade/ChaseAndEvade.MacOS.csproj
index e1cf8e53..3dccdcf4 100644
--- a/ChaseAndEvade/ChaseAndEvade.MacOS.csproj
+++ b/ChaseAndEvade/ChaseAndEvade.MacOS.csproj
@@ -1,23 +1,26 @@
+
Debug
AnyCPU
10.0.0
2.0
{D03F3BAF-E4D0-4B6B-A567-9A0E2F882335}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
ChaseAndEvade
ChaseAndEvade
True
+ v2.0
+ Xamarin.Mac
True
full
False
bin\Debug
- DEBUG MONOMAC
+ DEBUG;__MACOS__
prompt
4
False
@@ -31,6 +34,7 @@
none
False
bin\Release
+ __MACOS__
prompt
4
False
@@ -45,18 +49,18 @@
-
-
- False
- ..\..\..\..\MonoMac\monomac\src\MonoMac.dll
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
-
-
+
+
ChaseAndEvadeGame.cs
@@ -64,28 +68,10 @@
-
- Content\Arial.xnb
-
-
- Content\cat.png
-
-
- Content\mouse.png
-
-
- Content\tank.png
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
+
+
diff --git a/ChaseAndEvade/ChaseAndEvadeGame.cs b/ChaseAndEvade/ChaseAndEvadeGame.cs
index 0e3bc905..a700ec20 100755
--- a/ChaseAndEvade/ChaseAndEvadeGame.cs
+++ b/ChaseAndEvade/ChaseAndEvadeGame.cs
@@ -19,7 +19,6 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
-using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Media;
@@ -144,12 +143,12 @@ public ChaseAndEvadeGame ()
graphics.PreferredBackBufferHeight = 800;
TargetElapsedTime = TimeSpan.FromTicks(333333);
-#elif !MONOMAC
+#elif !__MACOS__
graphics.PreferredBackBufferWidth = 320;
graphics.PreferredBackBufferHeight = 480;
#endif
-#if WINDOWS || MONOMAC || LINUX
+#if WINDOWS || __MACOS__ || LINUX
graphics.IsFullScreen = false;
#else
graphics.IsFullScreen = true;
diff --git a/ChaseAndEvade/Content/Content.mgcb b/ChaseAndEvade/Content/Content.mgcb
new file mode 100644
index 00000000..11f6da2b
--- /dev/null
+++ b/ChaseAndEvade/Content/Content.mgcb
@@ -0,0 +1,54 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin\$(Platform)
+/intermediateDir:obj\$(Platform)
+/platform:Android
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+/reference:../packages/InfinitespaceStudios.Pipeline.1.0.8/tools/InfinitespaceStudios.Pipeline.dll
+
+#---------------------------------- Content ---------------------------------#
+
+#begin cat.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:cat.png
+
+#begin mouse.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:mouse.png
+
+#begin tank.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:tank.png
+
+#begin Arial.xnb
+/copy:Arial.xnb
\ No newline at end of file
diff --git a/ChaseAndEvade/Info.plist b/ChaseAndEvade/Info.plist
index 4b7b5077..f29e629a 100644
--- a/ChaseAndEvade/Info.plist
+++ b/ChaseAndEvade/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/ChaseAndEvade/Program.cs b/ChaseAndEvade/Program.cs
index c50f48b9..d9eab01a 100644
--- a/ChaseAndEvade/Program.cs
+++ b/ChaseAndEvade/Program.cs
@@ -1,18 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#elif IPHONE
-using MonoTouch.Foundation;
-using MonoTouch.UIKit;
+using Foundation;
+using UIKit;
#endif
namespace ChaseAndEvade
-{
-#if MONOMAC
- class Program
+{
+#if __MACOS__
+ class Program
{
static void Main (string[] args)
{
@@ -34,7 +34,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
ChaseAndEvadeGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new ChaseAndEvadeGame();
game.Run();
diff --git a/ChaseAndEvade/packages.config b/ChaseAndEvade/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/ChaseAndEvade/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Colored3DCube/Colored3DCube.MacOS.csproj b/Colored3DCube/Colored3DCube.MacOS.csproj
index af31047f..fd167d5d 100644
--- a/Colored3DCube/Colored3DCube.MacOS.csproj
+++ b/Colored3DCube/Colored3DCube.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
x86
10.0.0
2.0
{CF7A194A-CF38-4379-909F-1B5FFB8F79C4}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
Colored3DCube
Colored3DCube
+ True
+ v2.0
+ Xamarin.Mac
True
diff --git a/Colored3DCube/Program.cs b/Colored3DCube/Program.cs
index 4d9a7f07..0b4baa45 100644
--- a/Colored3DCube/Program.cs
+++ b/Colored3DCube/Program.cs
@@ -17,7 +17,7 @@ static void Main(string[] args)
}
}
#endif
-#if MONOMAC
+#if __MACOS__
static class Program
{
@@ -26,25 +26,25 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/Draw2D/Draw2D.MacOS.csproj b/Draw2D/Draw2D.MacOS.csproj
index 7188c7df..54cf8deb 100644
--- a/Draw2D/Draw2D.MacOS.csproj
+++ b/Draw2D/Draw2D.MacOS.csproj
@@ -1,16 +1,20 @@
+
Debug
AnyCPU
10.0.0
2.0
{A82EAD58-40D7-49BE-8F24-09FEA34F9E55}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
MonoGame.Samples.Draw2D.MacOS
MonoGame.Samples.Draw2D.MacOS
Microsoft.Xna.Samples.Draw2D.Program
+ True
+ v2.0
+ Xamarin.Mac
True
diff --git a/Draw2D/main.cs b/Draw2D/main.cs
index caf4795e..443087c5 100644
--- a/Draw2D/main.cs
+++ b/Draw2D/main.cs
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Linq;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -12,7 +12,7 @@
namespace Microsoft.Xna.Samples.Draw2D
{
-#if MONOMAC
+#if __MACOS__
class Program
{
static void Main (string[] args)
@@ -35,7 +35,7 @@ class AppDelegate : NSApplicationDelegate
{
private Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/FarseerPhysicsEngine/FarseerPhysicsEngine.csproj b/FarseerPhysicsEngine/FarseerPhysicsEngine.csproj
index 2b05c3c5..d8abc449 100644
--- a/FarseerPhysicsEngine/FarseerPhysicsEngine.csproj
+++ b/FarseerPhysicsEngine/FarseerPhysicsEngine.csproj
@@ -31,6 +31,9 @@
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\net40\MonoGame.Framework.dll
+
@@ -148,13 +151,7 @@
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
+
+
\ No newline at end of file
diff --git a/FarseerPhysicsEngine/packages.config b/FarseerPhysicsEngine/packages.config
new file mode 100644
index 00000000..3f31b994
--- /dev/null
+++ b/FarseerPhysicsEngine/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FarseerSamples/FarseerSamples.MacOS.csproj b/FarseerSamples/FarseerSamples.MacOS.csproj
index 2de77acb..5d2cf8e3 100644
--- a/FarseerSamples/FarseerSamples.MacOS.csproj
+++ b/FarseerSamples/FarseerSamples.MacOS.csproj
@@ -1,22 +1,28 @@
+
Debug
AnyCPU
10.0.0
2.0
{1221EA03-CCB7-4BC1-90C8-8B9816E1758D}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
FarseerSamples
FarseerSamples
+ v2.0
+ Resources
+ MacOSX
+
+ Xamarin.Mac
True
full
False
bin\Debug
- DEBUG;MONOMAC;DESKTOP
+ DEBUG;__MACOS__;DESKTOP
prompt
4
False
@@ -40,7 +46,7 @@
False
False
Mac Developer
- MONOMAC;DESKTOP
+ __MACOS__;DESKTOP
False
@@ -64,22 +70,16 @@
-
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
{D6E4E5BC-8998-4718-8E84-80901E6739CC}
FarseerPhysicsEngine
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
@@ -133,9 +133,8 @@
+
-
-
@@ -169,4 +168,28 @@
+
+
+ libopenal.1.dylib
+ Static
+
+
+ libSDL2-2.0.0.dylib
+ Static
+
+
+ libopenal.1.dylib
+ Dynamic
+ False
+ True
+
+
+ libSDL2-2.0.0.dylib
+ Dynamic
+ False
+
+
+
+
+
\ No newline at end of file
diff --git a/FarseerSamples/Info.plist b/FarseerSamples/Info.plist
index 2a4b5d53..dddbf767 100644
--- a/FarseerSamples/Info.plist
+++ b/FarseerSamples/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/FarseerSamples/Main.cs b/FarseerSamples/Main.cs
index d4a3e6aa..866af85d 100644
--- a/FarseerSamples/Main.cs
+++ b/FarseerSamples/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace FarseerPhysics.SamplesFramework
{
@@ -27,9 +27,9 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
- FarseerPhysicsGame game;
-
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ FarseerPhysicsGame game;
+
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new FarseerPhysicsGame ();
game.Run ();
diff --git a/FarseerSamples/packages.config b/FarseerSamples/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/FarseerSamples/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/.config/dotnet-tools.json b/GameStateManagement/.config/dotnet-tools.json
new file mode 100644
index 00000000..84ff03d0
--- /dev/null
+++ b/GameStateManagement/.config/dotnet-tools.json
@@ -0,0 +1,36 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "dotnet-mgcb": {
+ "version": "3.8.2.1105",
+ "commands": [
+ "mgcb"
+ ]
+ },
+ "dotnet-mgcb-editor": {
+ "version": "3.8.2.1105",
+ "commands": [
+ "mgcb-editor"
+ ]
+ },
+ "dotnet-mgcb-editor-linux": {
+ "version": "3.8.2.1105",
+ "commands": [
+ "mgcb-editor-linux"
+ ]
+ },
+ "dotnet-mgcb-editor-windows": {
+ "version": "3.8.2.1105",
+ "commands": [
+ "mgcb-editor-windows"
+ ]
+ },
+ "dotnet-mgcb-editor-mac": {
+ "version": "3.8.2.1105",
+ "commands": [
+ "mgcb-editor-mac"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/GameStateManagement/Game.cs b/GameStateManagement/Game.cs
deleted file mode 100755
index cb5991f0..00000000
--- a/GameStateManagement/Game.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// Game.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// Sample showing how to manage different game states, with transitions
- /// between menu screens, a loading screen, the game itself, and a pause
- /// menu. This main game class is extremely simple: all the interesting
- /// stuff happens in the ScreenManager component.
- ///
- public class GameStateManagementGame : Game
- {
- #region Fields
-
- GraphicsDeviceManager graphics;
- ScreenManager screenManager;
-
-#if ZUNE
- int BufferWidth = 272;
- int BufferHeight = 480;
-#elif IPHONE
- int BufferWidth = 320;
- int BufferHeight = 480;
-#else
- int BufferWidth = 272;
- int BufferHeight = 480;
-#endif
- #endregion
-
- #region Initialization
-
-
- ///
- /// The main game constructor.
- ///
- public GameStateManagementGame()
- {
- Content.RootDirectory = "Content";
-
- graphics = new GraphicsDeviceManager(this);
-
- graphics.PreferredBackBufferWidth = BufferWidth;
- graphics.PreferredBackBufferHeight = BufferHeight;
-
- // Create the screen manager component.
- screenManager = new ScreenManager(this);
-
- Components.Add(screenManager);
-
- // Activate the first screens.
- screenManager.AddScreen(new BackgroundScreen(), null);
- screenManager.AddScreen(new MainMenuScreen(), null);
- }
-
-
- #endregion
-
- #region Draw
-
-
- ///
- /// This is called when the game should draw itself.
- ///
- protected override void Draw(GameTime gameTime)
- {
- graphics.GraphicsDevice.Clear(Color.Black);
-
- // The real drawing happens inside the screen manager component.
- base.Draw(gameTime);
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/GameStateManagement.Android/AndroidManifest.xml b/GameStateManagement/GameStateManagement.Android/AndroidManifest.xml
new file mode 100644
index 00000000..000b910a
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Android/AndroidManifest.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/GameStateManagement/GameStateManagement.Android/GameStateManagement.Android.csproj b/GameStateManagement/GameStateManagement.Android/GameStateManagement.Android.csproj
new file mode 100644
index 00000000..ed3d171b
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Android/GameStateManagement.Android.csproj
@@ -0,0 +1,30 @@
+
+
+ net8.0-android
+ 23
+ Exe
+ com.companyname.GameStateManagement.Android
+ 1
+ 1.0
+
+
+
+
+
+
+
+ Content\GameStateManagement.mgcb
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.Android/MainActivity.cs b/GameStateManagement/GameStateManagement.Android/MainActivity.cs
new file mode 100644
index 00000000..c07d4971
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Android/MainActivity.cs
@@ -0,0 +1,46 @@
+//-----------------------------------------------------------------------------
+// MainActivity.cs
+//
+// MonoGame Foundation Game Platform
+// Copyright (C) MonoGame Foundation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+#region Using Statements
+using Android.App;
+using Android.Content.PM;
+using Android.OS;
+using Android.Views;
+
+using Microsoft.Xna.Framework;
+
+using GameStateManagement.Core;
+#endregion
+
+namespace GameStateManagement.Android;
+
+[Activity(
+ Label = "GameStateManagement",
+ MainLauncher = true,
+ Icon = "@drawable/icon",
+ Theme = "@style/Theme.Splash",
+ AlwaysRetainTaskState = true,
+ LaunchMode = LaunchMode.SingleInstance,
+ ScreenOrientation = ScreenOrientation.SensorLandscape,
+ ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden
+)]
+public class MainActivity : AndroidGameActivity
+{
+ private GameStateManagementGame _game;
+ private View _view;
+
+ protected override void OnCreate(Bundle bundle)
+ {
+ base.OnCreate(bundle);
+
+ _game = new GameStateManagementGame();
+ _view = _game.Services.GetService(typeof(View)) as View;
+
+ SetContentView(_view);
+ _game.Run();
+ }
+}
diff --git a/GameStateManagement/GameStateManagement.Android/Resources/Drawable/Icon.png b/GameStateManagement/GameStateManagement.Android/Resources/Drawable/Icon.png
new file mode 100644
index 00000000..8de5549d
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Android/Resources/Drawable/Icon.png differ
diff --git a/GameStateManagement/GameStateManagement.Android/Resources/Drawable/Splash.png b/GameStateManagement/GameStateManagement.Android/Resources/Drawable/Splash.png
new file mode 100644
index 00000000..75d9dd1a
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Android/Resources/Drawable/Splash.png differ
diff --git a/GameStateManagement/GameStateManagement.Android/Resources/Values/Strings.xml b/GameStateManagement/GameStateManagement.Android/Resources/Values/Strings.xml
new file mode 100644
index 00000000..f5bb254f
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Android/Resources/Values/Strings.xml
@@ -0,0 +1,4 @@
+
+
+ GameStateManagement
+
diff --git a/GameStateManagement/GameStateManagement.Android/Resources/Values/Styles.xml b/GameStateManagement/GameStateManagement.Android/Resources/Values/Styles.xml
new file mode 100644
index 00000000..51021340
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Android/Resources/Values/Styles.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Backgrounds/background.png b/GameStateManagement/GameStateManagement.Core/Content/Backgrounds/background.png
new file mode 100644
index 00000000..29fdd169
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Core/Content/Backgrounds/background.png differ
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Fonts/gamefont.spritefont b/GameStateManagement/GameStateManagement.Core/Content/Fonts/gamefont.spritefont
new file mode 100644
index 00000000..80d78be0
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Content/Fonts/gamefont.spritefont
@@ -0,0 +1,15 @@
+
+
+
+ Arial
+ 32
+ 2
+
+
+
+
+ ~
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Fonts/menufont.spritefont b/GameStateManagement/GameStateManagement.Core/Content/Fonts/menufont.spritefont
new file mode 100644
index 00000000..7359d65c
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Content/Fonts/menufont.spritefont
@@ -0,0 +1,15 @@
+
+
+
+ Arial
+ 23
+ 2
+
+
+
+
+ ~
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.Core/Content/GameStateManagement.contentproj b/GameStateManagement/GameStateManagement.Core/Content/GameStateManagement.contentproj
new file mode 100644
index 00000000..4af9a339
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Content/GameStateManagement.contentproj
@@ -0,0 +1,320 @@
+
+
+
+ {935F72E1-0493-499D-ABDB-A65808B8D304}
+ {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ Windows
+ x86
+ Library
+ Properties
+ ContentBuilderContentContent
+ v4.0
+ v4.0
+ Windows
+ bin\$(MonoGamePlatform)\$(Configuration)
+ Content
+ x86
+ ..\..\
+ true
+
+
+ Windows
+
+
+ Windows8
+
+
+ Android
+
+
+ iOS
+
+
+ OSX
+
+
+ Linux
+
+
+ PSM
+
+
+
+
+
+
+
+
+
+ ..\..\packages\MonoGame.ContentProcessors.3.2.1\lib\MonoGameContentProcessors.dll
+
+
+
+
+ Layer0_0
+ TextureImporter
+ TextureProcessor
+
+
+ Layer0_1
+ TextureImporter
+ TextureProcessor
+
+
+ Layer0_2
+ TextureImporter
+ TextureProcessor
+
+
+ Layer1_0
+ TextureImporter
+ TextureProcessor
+
+
+ Layer1_1
+ TextureImporter
+ TextureProcessor
+
+
+ Layer1_2
+ TextureImporter
+ TextureProcessor
+
+
+ Layer2_0
+ TextureImporter
+ TextureProcessor
+
+
+ Layer2_1
+ TextureImporter
+ TextureProcessor
+
+
+ Layer2_2
+ TextureImporter
+ TextureProcessor
+
+
+ 0
+ PreserveNewest
+
+
+ 1
+ PreserveNewest
+
+
+ 2
+ PreserveNewest
+
+
+ you_died
+ TextureImporter
+ TextureProcessor
+
+
+ you_lose
+ TextureImporter
+ TextureProcessor
+
+
+ you_win
+ TextureImporter
+ TextureProcessor
+
+
+ Music
+ WmaImporter
+ SongProcessor
+
+
+ Gem
+ TextureImporter
+ TextureProcessor
+
+
+ Idle
+ TextureImporter
+ TextureProcessor
+
+
+ Run
+ TextureImporter
+ TextureProcessor
+
+
+ Idle
+ TextureImporter
+ TextureProcessor
+
+
+ Run
+ TextureImporter
+ TextureProcessor
+
+
+ Idle
+ TextureImporter
+ TextureProcessor
+
+
+ Run
+ TextureImporter
+ TextureProcessor
+
+
+ Idle
+ TextureImporter
+ TextureProcessor
+
+
+ Run
+ TextureImporter
+ TextureProcessor
+
+
+ Celebrate
+ TextureImporter
+ TextureProcessor
+
+
+ Die
+ TextureImporter
+ TextureProcessor
+
+
+ Idle
+ TextureImporter
+ TextureProcessor
+
+
+ Jump
+ TextureImporter
+ TextureProcessor
+
+
+ Run
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA0
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA1
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA2
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA3
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA4
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA5
+ TextureImporter
+ TextureProcessor
+
+
+ BlockA6
+ TextureImporter
+ TextureProcessor
+
+
+ BlockB0
+ TextureImporter
+ TextureProcessor
+
+
+ BlockB1
+ TextureImporter
+ TextureProcessor
+
+
+ Exit
+ TextureImporter
+ TextureProcessor
+
+
+ Platform
+ TextureImporter
+ TextureProcessor
+
+
+ packages
+
+
+
+
+ Hud
+ FontDescriptionImporter
+ FontDescriptionProcessor
+
+
+
+
+ ExitReached
+ WavImporter
+ SoundEffectProcessor
+
+
+ GemCollected
+ WavImporter
+ SoundEffectProcessor
+
+
+ MonsterKilled
+ WavImporter
+ SoundEffectProcessor
+
+
+ PlayerFall
+ WavImporter
+ SoundEffectProcessor
+
+
+ PlayerJump
+ WavImporter
+ SoundEffectProcessor
+
+
+ PlayerKilled
+ WavImporter
+ SoundEffectProcessor
+
+
+ Powerup
+ WavImporter
+ SoundEffectProcessor
+
+
+
+
+ VirtualControlArrow
+ TextureImporter
+ TextureProcessor
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.Core/Content/GameStateManagement.mgcb b/GameStateManagement/GameStateManagement.Core/Content/GameStateManagement.mgcb
new file mode 100644
index 00000000..5ebc767d
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Content/GameStateManagement.mgcb
@@ -0,0 +1,64 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:DesktopGL
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
+#begin Backgrounds/background.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Backgrounds/background.png
+
+#begin Fonts/gamefont.spritefont
+/importer:FontDescriptionImporter
+/processor:FontDescriptionProcessor
+/processorParam:PremultiplyAlpha=True
+/processorParam:TextureFormat=Compressed
+/build:Fonts/gamefont.spritefont
+
+#begin Fonts/menufont.spritefont
+/importer:FontDescriptionImporter
+/processor:FontDescriptionProcessor
+/processorParam:PremultiplyAlpha=True
+/processorParam:TextureFormat=Compressed
+/build:Fonts/menufont.spritefont
+
+#begin Sprites/blank.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Sprites/blank.png
+
+#begin Sprites/gradient.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Sprites/gradient.png
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Icon.bmp b/GameStateManagement/GameStateManagement.Core/Content/Icon.bmp
new file mode 100644
index 00000000..2b481653
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Core/Content/Icon.bmp differ
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Icon.ico b/GameStateManagement/GameStateManagement.Core/Content/Icon.ico
new file mode 100644
index 00000000..7d9dec18
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Core/Content/Icon.ico differ
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Sprites/blank.png b/GameStateManagement/GameStateManagement.Core/Content/Sprites/blank.png
new file mode 100644
index 00000000..3165c372
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Core/Content/Sprites/blank.png differ
diff --git a/GameStateManagement/GameStateManagement.Core/Content/Sprites/gradient.png b/GameStateManagement/GameStateManagement.Core/Content/Sprites/gradient.png
new file mode 100644
index 00000000..1a5a0f76
Binary files /dev/null and b/GameStateManagement/GameStateManagement.Core/Content/Sprites/gradient.png differ
diff --git a/GameStateManagement/GameStateManagement.Core/GameStateManagement.Core.csproj b/GameStateManagement/GameStateManagement.Core/GameStateManagement.Core.csproj
new file mode 100644
index 00000000..aca92dc8
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/GameStateManagement.Core.csproj
@@ -0,0 +1,11 @@
+
+
+ net8.0
+ AnyCPU;x64
+
+
+
+ All
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.Core/GameStateManagementGame.cs b/GameStateManagement/GameStateManagement.Core/GameStateManagementGame.cs
new file mode 100644
index 00000000..cf9f3a73
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/GameStateManagementGame.cs
@@ -0,0 +1,78 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// Game.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// Sample showing how to manage different game states, with transitions
+/// between menu screens, a loading screen, the game itself, and a pause
+/// menu. This main game class is extremely simple: all the interesting
+/// stuff happens in the ScreenManager component.
+///
+public class GameStateManagementGame : Game
+{
+ #region Fields
+
+ GraphicsDeviceManager graphics;
+ ScreenManager screenManager;
+
+ int BufferWidth = 800;
+ int BufferHeight = 600;
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// The main game constructor.
+ ///
+ public GameStateManagementGame()
+ {
+ Content.RootDirectory = "Content";
+
+ graphics = new GraphicsDeviceManager(this);
+
+ graphics.PreferredBackBufferWidth = BufferWidth;
+ graphics.PreferredBackBufferHeight = BufferHeight;
+
+ // Create the screen manager component.
+ screenManager = new ScreenManager(this);
+
+ Components.Add(screenManager);
+
+ // Activate the first screens.
+ screenManager.AddScreen(new BackgroundScreen(), null);
+ screenManager.AddScreen(new MainMenuScreen(), null);
+ }
+
+
+ #endregion
+
+ #region Draw
+
+
+ ///
+ /// This is called when the game should draw itself.
+ ///
+ protected override void Draw(GameTime gameTime)
+ {
+ graphics.GraphicsDevice.Clear(Color.Black);
+
+ // The real drawing happens inside the screen manager component.
+ base.Draw(gameTime);
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/ScreenManager/GameScreen.cs b/GameStateManagement/GameStateManagement.Core/ScreenManager/GameScreen.cs
new file mode 100644
index 00000000..bc6b6417
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/ScreenManager/GameScreen.cs
@@ -0,0 +1,355 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// GameScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input.Touch;
+using System.IO;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// Enum describes the screen transition state.
+///
+public enum ScreenState
+{
+ TransitionOn,
+ Active,
+ TransitionOff,
+ Hidden,
+}
+
+
+///
+/// A screen is a single layer that has update and draw logic, and which
+/// can be combined with other layers to build up a complex menu system.
+/// For instance the main menu, the options menu, the "are you sure you
+/// want to quit" message box, and the main game itself are all implemented
+/// as screens.
+///
+public abstract class GameScreen
+{
+ #region Properties
+
+
+ ///
+ /// Normally when one screen is brought up over the top of another,
+ /// the first screen will transition off to make room for the new
+ /// one. This property indicates whether the screen is only a small
+ /// popup, in which case screens underneath it do not need to bother
+ /// transitioning off.
+ ///
+ public bool IsPopup
+ {
+ get { return isPopup; }
+ protected set { isPopup = value; }
+ }
+
+ bool isPopup = false;
+
+
+ ///
+ /// Indicates how long the screen takes to
+ /// transition on when it is activated.
+ ///
+ public TimeSpan TransitionOnTime
+ {
+ get { return transitionOnTime; }
+ protected set { transitionOnTime = value; }
+ }
+
+ TimeSpan transitionOnTime = TimeSpan.Zero;
+
+
+ ///
+ /// Indicates how long the screen takes to
+ /// transition off when it is deactivated.
+ ///
+ public TimeSpan TransitionOffTime
+ {
+ get { return transitionOffTime; }
+ protected set { transitionOffTime = value; }
+ }
+
+ TimeSpan transitionOffTime = TimeSpan.Zero;
+
+
+ ///
+ /// Gets the current position of the screen transition, ranging
+ /// from zero (fully active, no transition) to one (transitioned
+ /// fully off to nothing).
+ ///
+ public float TransitionPosition
+ {
+ get { return transitionPosition; }
+ protected set { transitionPosition = value; }
+ }
+
+ float transitionPosition = 1;
+
+
+ ///
+ /// Gets the current alpha of the screen transition, ranging
+ /// from 1 (fully active, no transition) to 0 (transitioned
+ /// fully off to nothing).
+ ///
+ public float TransitionAlpha
+ {
+ get { return 1f - TransitionPosition; }
+ }
+
+
+ ///
+ /// Gets the current screen transition state.
+ ///
+ public ScreenState ScreenState
+ {
+ get { return screenState; }
+ protected set { screenState = value; }
+ }
+
+ ScreenState screenState = ScreenState.TransitionOn;
+
+
+ ///
+ /// There are two possible reasons why a screen might be transitioning
+ /// off. It could be temporarily going away to make room for another
+ /// screen that is on top of it, or it could be going away for good.
+ /// This property indicates whether the screen is exiting for real:
+ /// if set, the screen will automatically remove itself as soon as the
+ /// transition finishes.
+ ///
+ public bool IsExiting
+ {
+ get { return isExiting; }
+ protected internal set { isExiting = value; }
+ }
+
+ bool isExiting = false;
+
+
+ ///
+ /// Checks whether this screen is active and can respond to user input.
+ ///
+ public bool IsActive
+ {
+ get
+ {
+ return !otherScreenHasFocus &&
+ (screenState == ScreenState.TransitionOn ||
+ screenState == ScreenState.Active);
+ }
+ }
+
+ bool otherScreenHasFocus;
+
+
+ ///
+ /// Gets the manager that this screen belongs to.
+ ///
+ public ScreenManager ScreenManager
+ {
+ get { return screenManager; }
+ internal set { screenManager = value; }
+ }
+
+ ScreenManager screenManager;
+
+
+ ///
+ /// Gets the index of the player who is currently controlling this screen,
+ /// or null if it is accepting input from any player. This is used to lock
+ /// the game to a specific player profile. The main menu responds to input
+ /// from any connected gamepad, but whichever player makes a selection from
+ /// this menu is given control over all subsequent screens, so other gamepads
+ /// are inactive until the controlling player returns to the main menu.
+ ///
+ public PlayerIndex? ControllingPlayer
+ {
+ get { return controllingPlayer; }
+ internal set { controllingPlayer = value; }
+ }
+
+ PlayerIndex? controllingPlayer;
+
+
+ ///
+ /// Gets the gestures the screen is interested in. Screens should be as specific
+ /// as possible with gestures to increase the accuracy of the gesture engine.
+ /// For example, most menus only need Tap or perhaps Tap and VerticalDrag to operate.
+ /// These gestures are handled by the ScreenManager when screens change and
+ /// all gestures are placed in the InputState passed to the HandleInput method.
+ ///
+ public GestureType EnabledGestures
+ {
+ get { return enabledGestures; }
+ protected set
+ {
+ enabledGestures = value;
+
+ // the screen manager handles this during screen changes, but
+ // if this screen is active and the gesture types are changing,
+ // we have to update the TouchPanel ourself.
+ if (ScreenState == ScreenState.Active)
+ {
+ TouchPanel.EnabledGestures = value;
+ }
+ }
+ }
+
+ GestureType enabledGestures = GestureType.None;
+
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Load graphics content for the screen.
+ ///
+ public virtual void LoadContent() { }
+
+
+ ///
+ /// Unload content for the screen.
+ ///
+ public virtual void UnloadContent() { }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Allows the screen to run logic, such as updating the transition position.
+ /// Unlike HandleInput, this method is called regardless of whether the screen
+ /// is active, hidden, or in the middle of a transition.
+ ///
+ public virtual void Update(GameTime gameTime, bool otherScreenHasFocus,
+ bool coveredByOtherScreen)
+ {
+ this.otherScreenHasFocus = otherScreenHasFocus;
+
+ if (isExiting)
+ {
+ // If the screen is going away to die, it should transition off.
+ screenState = ScreenState.TransitionOff;
+
+ if (!UpdateTransition(gameTime, transitionOffTime, 1))
+ {
+ // When the transition finishes, remove the screen.
+ ScreenManager.RemoveScreen(this);
+ }
+ }
+ else if (coveredByOtherScreen)
+ {
+ // If the screen is covered by another, it should transition off.
+ if (UpdateTransition(gameTime, transitionOffTime, 1))
+ {
+ // Still busy transitioning.
+ screenState = ScreenState.TransitionOff;
+ }
+ else
+ {
+ // Transition finished!
+ screenState = ScreenState.Hidden;
+ }
+ }
+ else
+ {
+ // Otherwise the screen should transition on and become active.
+ if (UpdateTransition(gameTime, transitionOnTime, -1))
+ {
+ // Still busy transitioning.
+ screenState = ScreenState.TransitionOn;
+ }
+ else
+ {
+ // Transition finished!
+ screenState = ScreenState.Active;
+ }
+ }
+ }
+
+
+ ///
+ /// Helper for updating the screen transition position.
+ ///
+ bool UpdateTransition(GameTime gameTime, TimeSpan time, int direction)
+ {
+ // How much should we move by?
+ float transitionDelta;
+
+ if (time == TimeSpan.Zero)
+ transitionDelta = 1;
+ else
+ transitionDelta = (float)(gameTime.ElapsedGameTime.TotalMilliseconds /
+ time.TotalMilliseconds);
+
+ // Update the transition position.
+ transitionPosition += transitionDelta * direction;
+
+ // Did we reach the end of the transition?
+ if (((direction < 0) && (transitionPosition <= 0)) ||
+ ((direction > 0) && (transitionPosition >= 1)))
+ {
+ transitionPosition = MathHelper.Clamp(transitionPosition, 0, 1);
+ return false;
+ }
+
+ // Otherwise we are still busy transitioning.
+ return true;
+ }
+
+
+ ///
+ /// Allows the screen to handle user input. Unlike Update, this method
+ /// is only called when the screen is active, and not when some other
+ /// screen has taken the focus.
+ ///
+ public virtual void HandleInput(InputState input) { }
+
+
+ ///
+ /// This is called when the screen should draw itself.
+ ///
+ public virtual void Draw(GameTime gameTime) { }
+
+
+ #endregion
+
+ #region Public Methods
+
+
+ ///
+ /// Tells the screen to go away. Unlike ScreenManager.RemoveScreen, which
+ /// instantly kills the screen, this method respects the transition timings
+ /// and will give the screen a chance to gradually transition off.
+ ///
+ public void ExitScreen()
+ {
+ if (TransitionOffTime == TimeSpan.Zero)
+ {
+ // If the screen has a zero transition time, remove it immediately.
+ ScreenManager.RemoveScreen(this);
+ }
+ else
+ {
+ // Otherwise flag that it should transition off and then exit.
+ isExiting = true;
+ }
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/ScreenManager/InputState.cs b/GameStateManagement/GameStateManagement.Core/ScreenManager/InputState.cs
new file mode 100644
index 00000000..97c9a0c1
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/ScreenManager/InputState.cs
@@ -0,0 +1,236 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// InputState.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Input.Touch;
+using System.Collections.Generic;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// Helper for reading input from keyboard, gamepad, and touch input. This class
+/// tracks both the current and previous state of the input devices, and implements
+/// query methods for high level input actions such as "move up through the menu"
+/// or "pause the game".
+///
+public class InputState
+{
+ #region Fields
+
+ public const int MaxInputs = 4;
+
+ public readonly KeyboardState[] CurrentKeyboardStates;
+ public readonly GamePadState[] CurrentGamePadStates;
+
+ public readonly KeyboardState[] LastKeyboardStates;
+ public readonly GamePadState[] LastGamePadStates;
+
+ public readonly bool[] GamePadWasConnected;
+
+ public TouchCollection TouchState;
+
+ public readonly List Gestures = new List();
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructs a new input state.
+ ///
+ public InputState()
+ {
+ CurrentKeyboardStates = new KeyboardState[MaxInputs];
+ CurrentGamePadStates = new GamePadState[MaxInputs];
+
+ LastKeyboardStates = new KeyboardState[MaxInputs];
+ LastGamePadStates = new GamePadState[MaxInputs];
+
+ GamePadWasConnected = new bool[MaxInputs];
+ }
+
+
+ #endregion
+
+ #region Public Methods
+
+
+ ///
+ /// Reads the latest state of the keyboard and gamepad.
+ ///
+ public void Update()
+ {
+ for (int i = 0; i < MaxInputs; i++)
+ {
+ LastKeyboardStates[i] = CurrentKeyboardStates[i];
+ LastGamePadStates[i] = CurrentGamePadStates[i];
+
+ CurrentKeyboardStates[i] = Keyboard.GetState();
+ CurrentGamePadStates[i] = GamePad.GetState((PlayerIndex)i);
+
+ // Keep track of whether a gamepad has ever been
+ // connected, so we can detect if it is unplugged.
+ if (CurrentGamePadStates[i].IsConnected)
+ {
+ GamePadWasConnected[i] = true;
+ }
+ }
+
+ TouchState = TouchPanel.GetState();
+
+ Gestures.Clear();
+ while (TouchPanel.IsGestureAvailable)
+ {
+ Gestures.Add(TouchPanel.ReadGesture());
+ }
+ }
+
+
+ ///
+ /// Helper for checking if a key was newly pressed during this update. The
+ /// controllingPlayer parameter specifies which player to read input for.
+ /// If this is null, it will accept input from any player. When a keypress
+ /// is detected, the output playerIndex reports which player pressed it.
+ ///
+ public bool IsNewKeyPress(Keys key, PlayerIndex? controllingPlayer,
+ out PlayerIndex playerIndex)
+ {
+ if (controllingPlayer.HasValue)
+ {
+ // Read input from the specified player.
+ playerIndex = controllingPlayer.Value;
+
+ int i = (int)playerIndex;
+
+ return (CurrentKeyboardStates[i].IsKeyDown(key) &&
+ LastKeyboardStates[i].IsKeyUp(key));
+ }
+ else
+ {
+ // Accept input from any player.
+ return (IsNewKeyPress(key, PlayerIndex.One, out playerIndex) ||
+ IsNewKeyPress(key, PlayerIndex.Two, out playerIndex) ||
+ IsNewKeyPress(key, PlayerIndex.Three, out playerIndex) ||
+ IsNewKeyPress(key, PlayerIndex.Four, out playerIndex));
+ }
+ }
+
+
+ ///
+ /// Helper for checking if a button was newly pressed during this update.
+ /// The controllingPlayer parameter specifies which player to read input for.
+ /// If this is null, it will accept input from any player. When a button press
+ /// is detected, the output playerIndex reports which player pressed it.
+ ///
+ public bool IsNewButtonPress(Buttons button, PlayerIndex? controllingPlayer,
+ out PlayerIndex playerIndex)
+ {
+ if (controllingPlayer.HasValue)
+ {
+ // Read input from the specified player.
+ playerIndex = controllingPlayer.Value;
+
+ int i = (int)playerIndex;
+
+ return (CurrentGamePadStates[i].IsButtonDown(button) &&
+ LastGamePadStates[i].IsButtonUp(button));
+ }
+ else
+ {
+ // Accept input from any player.
+ return (IsNewButtonPress(button, PlayerIndex.One, out playerIndex) ||
+ IsNewButtonPress(button, PlayerIndex.Two, out playerIndex) ||
+ IsNewButtonPress(button, PlayerIndex.Three, out playerIndex) ||
+ IsNewButtonPress(button, PlayerIndex.Four, out playerIndex));
+ }
+ }
+
+
+ ///
+ /// Checks for a "menu select" input action.
+ /// The controllingPlayer parameter specifies which player to read input for.
+ /// If this is null, it will accept input from any player. When the action
+ /// is detected, the output playerIndex reports which player pressed it.
+ ///
+ public bool IsMenuSelect(PlayerIndex? controllingPlayer,
+ out PlayerIndex playerIndex)
+ {
+ return IsNewKeyPress(Keys.Space, controllingPlayer, out playerIndex) ||
+ IsNewKeyPress(Keys.Enter, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.A, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
+ }
+
+
+ ///
+ /// Checks for a "menu cancel" input action.
+ /// The controllingPlayer parameter specifies which player to read input for.
+ /// If this is null, it will accept input from any player. When the action
+ /// is detected, the output playerIndex reports which player pressed it.
+ ///
+ public bool IsMenuCancel(PlayerIndex? controllingPlayer,
+ out PlayerIndex playerIndex)
+ {
+ return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.B, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex);
+ }
+
+
+ ///
+ /// Checks for a "menu up" input action.
+ /// The controllingPlayer parameter specifies which player to read
+ /// input for. If this is null, it will accept input from any player.
+ ///
+ public bool IsMenuUp(PlayerIndex? controllingPlayer)
+ {
+ PlayerIndex playerIndex;
+
+ return IsNewKeyPress(Keys.Up, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.DPadUp, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.LeftThumbstickUp, controllingPlayer, out playerIndex);
+ }
+
+
+ ///
+ /// Checks for a "menu down" input action.
+ /// The controllingPlayer parameter specifies which player to read
+ /// input for. If this is null, it will accept input from any player.
+ ///
+ public bool IsMenuDown(PlayerIndex? controllingPlayer)
+ {
+ PlayerIndex playerIndex;
+
+ return IsNewKeyPress(Keys.Down, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.DPadDown, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.LeftThumbstickDown, controllingPlayer, out playerIndex);
+ }
+
+
+ ///
+ /// Checks for a "pause the game" input action.
+ /// The controllingPlayer parameter specifies which player to read
+ /// input for. If this is null, it will accept input from any player.
+ ///
+ public bool IsPauseGame(PlayerIndex? controllingPlayer)
+ {
+ PlayerIndex playerIndex;
+
+ return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex) ||
+ IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/ScreenManager/ScreenManager.cs b/GameStateManagement/GameStateManagement.Core/ScreenManager/ScreenManager.cs
new file mode 100644
index 00000000..9f94eb73
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/ScreenManager/ScreenManager.cs
@@ -0,0 +1,314 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// ScreenManager.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using System.Diagnostics;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input.Touch;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// The screen manager is a component which manages one or more GameScreen
+/// instances. It maintains a stack of screens, calls their Update and Draw
+/// methods at the appropriate times, and automatically routes input to the
+/// topmost active screen.
+///
+public class ScreenManager : DrawableGameComponent
+{
+ #region Fields
+
+ List screens = new List();
+ List screensToUpdate = new List();
+
+ InputState input = new InputState();
+
+ SpriteBatch spriteBatch;
+ SpriteFont font;
+ Texture2D blankTexture;
+
+ bool isInitialized;
+
+ bool traceEnabled;
+
+ #endregion
+
+ #region Properties
+
+
+ ///
+ /// A default SpriteBatch shared by all the screens. This saves
+ /// each screen having to bother creating their own local instance.
+ ///
+ public SpriteBatch SpriteBatch
+ {
+ get { return spriteBatch; }
+ }
+
+
+ ///
+ /// A default font shared by all the screens. This saves
+ /// each screen having to bother loading their own local copy.
+ ///
+ public SpriteFont Font
+ {
+ get { return font; }
+ }
+
+
+ ///
+ /// If true, the manager prints out a list of all the screens
+ /// each time it is updated. This can be useful for making sure
+ /// everything is being added and removed at the right times.
+ ///
+ public bool TraceEnabled
+ {
+ get { return traceEnabled; }
+ set { traceEnabled = value; }
+ }
+
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructs a new screen manager component.
+ ///
+ public ScreenManager(Game game)
+ : base(game)
+ {
+ // we must set EnabledGestures before we can query for them, but
+ // we don't assume the game wants to read them.
+ TouchPanel.EnabledGestures = GestureType.None;
+ }
+
+
+ ///
+ /// Initializes the screen manager component.
+ ///
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ isInitialized = true;
+ }
+
+
+ ///
+ /// Load your graphics content.
+ ///
+ protected override void LoadContent()
+ {
+ // Load content belonging to the screen manager.
+ ContentManager content = Game.Content;
+
+ spriteBatch = new SpriteBatch(GraphicsDevice);
+ font = content.Load("Fonts/menufont");
+ blankTexture = content.Load("Sprites/blank");
+
+ // Tell each of the screens to load their content.
+ foreach (GameScreen screen in screens)
+ {
+ screen.LoadContent();
+ }
+ }
+
+
+ ///
+ /// Unload your graphics content.
+ ///
+ protected override void UnloadContent()
+ {
+ // Tell each of the screens to unload their content.
+ foreach (GameScreen screen in screens)
+ {
+ screen.UnloadContent();
+ }
+ }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Allows each screen to run logic.
+ ///
+ public override void Update(GameTime gameTime)
+ {
+ // Read the keyboard and gamepad.
+ input.Update();
+
+ // Make a copy of the master screen list, to avoid confusion if
+ // the process of updating one screen adds or removes others.
+ screensToUpdate.Clear();
+
+ foreach (GameScreen screen in screens)
+ screensToUpdate.Add(screen);
+
+ bool otherScreenHasFocus = !Game.IsActive;
+ bool coveredByOtherScreen = false;
+
+ // Loop as long as there are screens waiting to be updated.
+ while (screensToUpdate.Count > 0)
+ {
+ // Pop the topmost screen off the waiting list.
+ GameScreen screen = screensToUpdate[screensToUpdate.Count - 1];
+
+ screensToUpdate.RemoveAt(screensToUpdate.Count - 1);
+
+ // Update the screen.
+ screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
+
+ if (screen.ScreenState == ScreenState.TransitionOn ||
+ screen.ScreenState == ScreenState.Active)
+ {
+ // If this is the first active screen we came across,
+ // give it a chance to handle input.
+ if (!otherScreenHasFocus)
+ {
+ screen.HandleInput(input);
+
+ otherScreenHasFocus = true;
+ }
+
+ // If this is an active non-popup, inform any subsequent
+ // screens that they are covered by it.
+ if (!screen.IsPopup)
+ coveredByOtherScreen = true;
+ }
+ }
+
+ // Print debug trace?
+ if (traceEnabled)
+ TraceScreens();
+ }
+
+
+ ///
+ /// Prints a list of all the screens, for debugging.
+ ///
+ void TraceScreens()
+ {
+ List screenNames = new List();
+
+ foreach (GameScreen screen in screens)
+ screenNames.Add(screen.GetType().Name);
+
+ Debug.WriteLine(string.Join(", ", screenNames.ToArray()));
+ }
+
+
+ ///
+ /// Tells each screen to draw itself.
+ ///
+ public override void Draw(GameTime gameTime)
+ {
+ foreach (GameScreen screen in screens)
+ {
+ if (screen.ScreenState == ScreenState.Hidden)
+ continue;
+
+ screen.Draw(gameTime);
+ }
+ }
+
+
+ #endregion
+
+ #region Public Methods
+
+
+ ///
+ /// Adds a new screen to the screen manager.
+ ///
+ public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
+ {
+ screen.ControllingPlayer = controllingPlayer;
+ screen.ScreenManager = this;
+ screen.IsExiting = false;
+
+ // If we have a graphics device, tell the screen to load content.
+ if (isInitialized)
+ {
+ screen.LoadContent();
+ }
+
+ screens.Add(screen);
+
+ // update the TouchPanel to respond to gestures this screen is interested in
+ TouchPanel.EnabledGestures = screen.EnabledGestures;
+ }
+
+
+ ///
+ /// Removes a screen from the screen manager. You should normally
+ /// use GameScreen.ExitScreen instead of calling this directly, so
+ /// the screen can gradually transition off rather than just being
+ /// instantly removed.
+ ///
+ public void RemoveScreen(GameScreen screen)
+ {
+ // If we have a graphics device, tell the screen to unload content.
+ if (isInitialized)
+ {
+ screen.UnloadContent();
+ }
+
+ screens.Remove(screen);
+ screensToUpdate.Remove(screen);
+
+ // if there is a screen still in the manager, update TouchPanel
+ // to respond to gestures that screen is interested in.
+ if (screens.Count > 0)
+ {
+ TouchPanel.EnabledGestures = screens[screens.Count - 1].EnabledGestures;
+ }
+ }
+
+
+ ///
+ /// Expose an array holding all the screens. We return a copy rather
+ /// than the real master list, because screens should only ever be added
+ /// or removed using the AddScreen and RemoveScreen methods.
+ ///
+ public GameScreen[] GetScreens()
+ {
+ return screens.ToArray();
+ }
+
+
+ ///
+ /// Helper draws a translucent black fullscreen sprite, used for fading
+ /// screens in and out, and for darkening the background behind popups.
+ ///
+ public void FadeBackBufferToBlack(float alpha)
+ {
+ Viewport viewport = GraphicsDevice.Viewport;
+
+ spriteBatch.Begin();
+
+ spriteBatch.Draw(blankTexture,
+ new Rectangle(0, 0, viewport.Width, viewport.Height),
+ Color.Black * alpha);
+
+ spriteBatch.End();
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/BackgroundScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/BackgroundScreen.cs
new file mode 100644
index 00000000..0e480fb3
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/BackgroundScreen.cs
@@ -0,0 +1,109 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// BackgroundScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// The background screen sits behind all the other menu screens.
+/// It draws a background image that remains fixed in place regardless
+/// of whatever transitions the screens on top of it may be doing.
+///
+class BackgroundScreen : GameScreen
+{
+ #region Fields
+
+ ContentManager content;
+ Texture2D backgroundTexture;
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructor.
+ ///
+ public BackgroundScreen()
+ {
+ TransitionOnTime = TimeSpan.FromSeconds(0.5);
+ TransitionOffTime = TimeSpan.FromSeconds(0.5);
+ }
+
+
+ ///
+ /// Loads graphics content for this screen. The background texture is quite
+ /// big, so we use our own local ContentManager to load it. This allows us
+ /// to unload before going from the menus into the game itself, wheras if we
+ /// used the shared ContentManager provided by the Game class, the content
+ /// would remain loaded forever.
+ ///
+ public override void LoadContent()
+ {
+ if (content == null)
+ content = new ContentManager(ScreenManager.Game.Services, "Content");
+
+ backgroundTexture = content.Load("Backgrounds/background");
+ }
+
+
+ ///
+ /// Unloads graphics content for this screen.
+ ///
+ public override void UnloadContent()
+ {
+ content.Unload();
+ }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Updates the background screen. Unlike most screens, this should not
+ /// transition off even if it has been covered by another screen: it is
+ /// supposed to be covered, after all! This overload forces the
+ /// coveredByOtherScreen parameter to false in order to stop the base
+ /// Update method wanting to transition off.
+ ///
+ public override void Update(GameTime gameTime, bool otherScreenHasFocus,
+ bool coveredByOtherScreen)
+ {
+ base.Update(gameTime, otherScreenHasFocus, false);
+ }
+
+
+ ///
+ /// Draws the background screen.
+ ///
+ public override void Draw(GameTime gameTime)
+ {
+ SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
+ Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
+ Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);
+
+ spriteBatch.Begin();
+
+ spriteBatch.Draw(backgroundTexture, fullscreen,
+ new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));
+
+ spriteBatch.End();
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/GameplayScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/GameplayScreen.cs
new file mode 100644
index 00000000..5537adee
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/GameplayScreen.cs
@@ -0,0 +1,216 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// GameplayScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using System.Threading;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// This screen implements the actual game logic. It is just a
+/// placeholder to get the idea across: you'll probably want to
+/// put some more interesting gameplay in here!
+///
+class GameplayScreen : GameScreen
+{
+ #region Fields
+
+ ContentManager content;
+ SpriteFont gameFont;
+
+ Vector2 playerPosition = new Vector2(100, 100);
+ Vector2 enemyPosition = new Vector2(100, 100);
+
+ Random random = new Random();
+
+ float pauseAlpha;
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructor.
+ ///
+ public GameplayScreen()
+ {
+ TransitionOnTime = TimeSpan.FromSeconds(1.5);
+ TransitionOffTime = TimeSpan.FromSeconds(0.5);
+ }
+
+
+ ///
+ /// Load graphics content for the game.
+ ///
+ public override void LoadContent()
+ {
+ if (content == null)
+ content = new ContentManager(ScreenManager.Game.Services, "Content");
+
+ gameFont = content.Load("Fonts/gamefont");
+
+ // A real game would probably have more content than this sample, so
+ // it would take longer to load. We simulate that by delaying for a
+ // while, giving you a chance to admire the beautiful loading screen.
+ Thread.Sleep(1000);
+
+ // once the load has finished, we use ResetElapsedTime to tell the game's
+ // timing mechanism that we have just finished a very long frame, and that
+ // it should not try to catch up.
+ ScreenManager.Game.ResetElapsedTime();
+ }
+
+
+ ///
+ /// Unload graphics content used by the game.
+ ///
+ public override void UnloadContent()
+ {
+ content.Unload();
+ }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Updates the state of the game. This method checks the GameScreen.IsActive
+ /// property, so the game will stop updating when the pause menu is active,
+ /// or if you tab away to a different application.
+ ///
+ public override void Update(GameTime gameTime, bool otherScreenHasFocus,
+ bool coveredByOtherScreen)
+ {
+ base.Update(gameTime, otherScreenHasFocus, false);
+
+ // Gradually fade in or out depending on whether we are covered by the pause screen.
+ if (coveredByOtherScreen)
+ pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
+ else
+ pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);
+
+ if (IsActive)
+ {
+ // Apply some random jitter to make the enemy move around.
+ const float randomization = 10;
+
+ enemyPosition.X += (float)(random.NextDouble() - 0.5) * randomization;
+ enemyPosition.Y += (float)(random.NextDouble() - 0.5) * randomization;
+
+ // Apply a stabilizing force to stop the enemy moving off the screen.
+ Vector2 targetPosition = new Vector2(
+ ScreenManager.GraphicsDevice.Viewport.Width / 2 - gameFont.MeasureString("Insert Gameplay Here").X / 2,
+ 200);
+
+ enemyPosition = Vector2.Lerp(enemyPosition, targetPosition, 0.05f);
+
+ // TODO: this game isn't very fun! You could probably improve
+ // it by inserting something more interesting in this space :-)
+ }
+ }
+
+
+ ///
+ /// Lets the game respond to player input. Unlike the Update method,
+ /// this will only be called when the gameplay screen is active.
+ ///
+ public override void HandleInput(InputState input)
+ {
+ if (input == null)
+ throw new ArgumentNullException("input");
+
+ // Look up inputs for the active player profile.
+ int playerIndex = (int)ControllingPlayer.Value;
+
+ KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];
+ GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];
+
+ // The game pauses either if the user presses the pause button, or if
+ // they unplug the active gamepad. This requires us to keep track of
+ // whether a gamepad was ever plugged in, because we don't want to pause
+ // on PC if they are playing with a keyboard and have no gamepad at all!
+ bool gamePadDisconnected = !gamePadState.IsConnected &&
+ input.GamePadWasConnected[playerIndex];
+
+ if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)
+ {
+ ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
+ }
+ else
+ {
+ // Otherwise move the player position.
+ Vector2 movement = Vector2.Zero;
+
+ if (keyboardState.IsKeyDown(Keys.Left))
+ movement.X--;
+
+ if (keyboardState.IsKeyDown(Keys.Right))
+ movement.X++;
+
+ if (keyboardState.IsKeyDown(Keys.Up))
+ movement.Y--;
+
+ if (keyboardState.IsKeyDown(Keys.Down))
+ movement.Y++;
+
+ Vector2 thumbstick = gamePadState.ThumbSticks.Left;
+
+ movement.X += thumbstick.X;
+ movement.Y -= thumbstick.Y;
+
+ if (movement.Length() > 1)
+ movement.Normalize();
+
+ playerPosition += movement * 2;
+ }
+ }
+
+
+ ///
+ /// Draws the gameplay screen.
+ ///
+ public override void Draw(GameTime gameTime)
+ {
+ // This game has a blue background. Why? Because!
+ ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
+ Color.CornflowerBlue, 0, 0);
+
+ // Our player and enemy are both actually just text strings.
+ SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
+
+ spriteBatch.Begin();
+
+ spriteBatch.DrawString(gameFont, "// TODO", playerPosition, Color.Green);
+
+ spriteBatch.DrawString(gameFont, "Insert Gameplay Here",
+ enemyPosition, Color.DarkRed);
+
+ spriteBatch.End();
+
+ // If the game is transitioning on or off, fade it out to black.
+ if (TransitionPosition > 0 || pauseAlpha > 0)
+ {
+ float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);
+
+ ScreenManager.FadeBackBufferToBlack(alpha);
+ }
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/LoadingScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/LoadingScreen.cs
new file mode 100644
index 00000000..f6d3f5f2
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/LoadingScreen.cs
@@ -0,0 +1,161 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// LoadingScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// The loading screen coordinates transitions between the menu system and the
+/// game itself. Normally one screen will transition off at the same time as
+/// the next screen is transitioning on, but for larger transitions that can
+/// take a longer time to load their data, we want the menu system to be entirely
+/// gone before we start loading the game. This is done as follows:
+///
+/// - Tell all the existing screens to transition off.
+/// - Activate a loading screen, which will transition on at the same time.
+/// - The loading screen watches the state of the previous screens.
+/// - When it sees they have finished transitioning off, it activates the real
+/// next screen, which may take a long time to load its data. The loading
+/// screen will be the only thing displayed while this load is taking place.
+///
+class LoadingScreen : GameScreen
+{
+ #region Fields
+
+ bool loadingIsSlow;
+ bool otherScreensAreGone;
+
+ GameScreen[] screensToLoad;
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// The constructor is private: loading screens should
+ /// be activated via the static Load method instead.
+ ///
+ private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
+ GameScreen[] screensToLoad)
+ {
+ this.loadingIsSlow = loadingIsSlow;
+ this.screensToLoad = screensToLoad;
+
+ TransitionOnTime = TimeSpan.FromSeconds(0.5);
+ }
+
+
+ ///
+ /// Activates the loading screen.
+ ///
+ public static void Load(ScreenManager screenManager, bool loadingIsSlow,
+ PlayerIndex? controllingPlayer,
+ params GameScreen[] screensToLoad)
+ {
+ // Tell all the current screens to transition off.
+ foreach (GameScreen screen in screenManager.GetScreens())
+ screen.ExitScreen();
+
+ // Create and activate the loading screen.
+ LoadingScreen loadingScreen = new LoadingScreen(screenManager,
+ loadingIsSlow,
+ screensToLoad);
+
+ screenManager.AddScreen(loadingScreen, controllingPlayer);
+ }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Updates the loading screen.
+ ///
+ public override void Update(GameTime gameTime, bool otherScreenHasFocus,
+ bool coveredByOtherScreen)
+ {
+ base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
+
+ // If all the previous screens have finished transitioning
+ // off, it is time to actually perform the load.
+ if (otherScreensAreGone)
+ {
+ ScreenManager.RemoveScreen(this);
+
+ foreach (GameScreen screen in screensToLoad)
+ {
+ if (screen != null)
+ {
+ ScreenManager.AddScreen(screen, ControllingPlayer);
+ }
+ }
+
+ // Once the load has finished, we use ResetElapsedTime to tell
+ // the game timing mechanism that we have just finished a very
+ // long frame, and that it should not try to catch up.
+ ScreenManager.Game.ResetElapsedTime();
+ }
+ }
+
+
+ ///
+ /// Draws the loading screen.
+ ///
+ public override void Draw(GameTime gameTime)
+ {
+ // If we are the only active screen, that means all the previous screens
+ // must have finished transitioning off. We check for this in the Draw
+ // method, rather than in Update, because it isn't enough just for the
+ // screens to be gone: in order for the transition to look good we must
+ // have actually drawn a frame without them before we perform the load.
+ if ((ScreenState == ScreenState.Active) &&
+ (ScreenManager.GetScreens().Length == 1))
+ {
+ otherScreensAreGone = true;
+ }
+
+ // The gameplay screen takes a while to load, so we display a loading
+ // message while that is going on, but the menus load very quickly, and
+ // it would look silly if we flashed this up for just a fraction of a
+ // second while returning from the game to the menus. This parameter
+ // tells us how long the loading is going to take, so we know whether
+ // to bother drawing the message.
+ if (loadingIsSlow)
+ {
+ SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
+ SpriteFont font = ScreenManager.Font;
+
+ const string message = "Loading...";
+
+ // Center the text in the viewport.
+ Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
+ Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
+ Vector2 textSize = font.MeasureString(message);
+ Vector2 textPosition = (viewportSize - textSize) / 2;
+
+ Color color = Color.White * TransitionAlpha;
+
+ // Draw the text.
+ spriteBatch.Begin();
+ spriteBatch.DrawString(font, message, textPosition, color);
+ spriteBatch.End();
+ }
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/MainMenuScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/MainMenuScreen.cs
new file mode 100644
index 00000000..83154d2b
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/MainMenuScreen.cs
@@ -0,0 +1,97 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// MainMenuScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using Microsoft.Xna.Framework;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// The main menu screen is the first thing displayed when the game starts up.
+///
+class MainMenuScreen : MenuScreen
+{
+ #region Initialization
+
+
+ ///
+ /// Constructor fills in the menu contents.
+ ///
+ public MainMenuScreen()
+ : base("Main Menu")
+ {
+ // Create our menu entries.
+ MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
+ MenuEntry optionsMenuEntry = new MenuEntry("Options");
+ MenuEntry exitMenuEntry = new MenuEntry("Exit");
+
+ // Hook up menu event handlers.
+ playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
+ optionsMenuEntry.Selected += OptionsMenuEntrySelected;
+ exitMenuEntry.Selected += OnCancel;
+
+ // Add entries to the menu.
+ MenuEntries.Add(playGameMenuEntry);
+ MenuEntries.Add(optionsMenuEntry);
+ MenuEntries.Add(exitMenuEntry);
+ }
+
+
+ #endregion
+
+ #region Handle Input
+
+
+ ///
+ /// Event handler for when the Play Game menu entry is selected.
+ ///
+ void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
+ new GameplayScreen());
+ }
+
+
+ ///
+ /// Event handler for when the Options menu entry is selected.
+ ///
+ void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex);
+ }
+
+
+ ///
+ /// When the user cancels the main menu, ask if they want to exit the sample.
+ ///
+ protected override void OnCancel(PlayerIndex playerIndex)
+ {
+ const string message = "Are you sure you want to exit this sample?";
+
+ MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);
+
+ confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
+
+ ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
+ }
+
+
+ ///
+ /// Event handler for when the user selects ok on the "are you sure
+ /// you want to exit" message box.
+ ///
+ void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
+ {
+ ScreenManager.Game.Exit();
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/MenuEntry.cs b/GameStateManagement/GameStateManagement.Core/Screens/MenuEntry.cs
new file mode 100644
index 00000000..a07d2b32
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/MenuEntry.cs
@@ -0,0 +1,190 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// MenuEntry.cs
+//
+// XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// Helper class represents a single entry in a MenuScreen. By default this
+/// just draws the entry text string, but it can be customized to display menu
+/// entries in different ways. This also provides an event that will be raised
+/// when the menu entry is selected.
+///
+class MenuEntry
+{
+ #region Fields
+
+ ///
+ /// The text rendered for this entry.
+ ///
+ string text;
+
+ ///
+ /// Tracks a fading selection effect on the entry.
+ ///
+ ///
+ /// The entries transition out of the selection effect when they are deselected.
+ ///
+ float selectionFade;
+
+ ///
+ /// The position at which the entry is drawn. This is set by the MenuScreen
+ /// each frame in Update.
+ ///
+ Vector2 position;
+
+ #endregion
+
+ #region Properties
+
+
+ ///
+ /// Gets or sets the text of this menu entry.
+ ///
+ public string Text
+ {
+ get { return text; }
+ set { text = value; }
+ }
+
+
+ ///
+ /// Gets or sets the position at which to draw this menu entry.
+ ///
+ public Vector2 Position
+ {
+ get { return position; }
+ set { position = value; }
+ }
+
+
+ #endregion
+
+ #region Events
+
+
+ ///
+ /// Event raised when the menu entry is selected.
+ ///
+ public event EventHandler Selected;
+
+
+ ///
+ /// Method for raising the Selected event.
+ ///
+ protected internal virtual void OnSelectEntry(PlayerIndex playerIndex)
+ {
+ if (Selected != null)
+ Selected(this, new PlayerIndexEventArgs(playerIndex));
+ }
+
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructs a new menu entry with the specified text.
+ ///
+ public MenuEntry(string text)
+ {
+ this.text = text;
+ }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Updates the menu entry.
+ ///
+ public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
+ {
+ // there is no such thing as a selected item on Windows Phone, so we always
+ // force isSelected to be false
+#if WINDOWS_PHONE
+ isSelected = false;
+#endif
+
+ // When the menu selection changes, entries gradually fade between
+ // their selected and deselected appearance, rather than instantly
+ // popping to the new state.
+ float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;
+
+ if (isSelected)
+ selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
+ else
+ selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
+ }
+
+
+ ///
+ /// Draws the menu entry. This can be overridden to customize the appearance.
+ ///
+ public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
+ {
+ // there is no such thing as a selected item on Windows Phone, so we always
+ // force isSelected to be false
+#if WINDOWS_PHONE
+ isSelected = false;
+#endif
+
+ // Draw the selected entry in yellow, otherwise white.
+ Color color = isSelected ? Color.Yellow : Color.White;
+
+ // Pulsate the size of the selected menu entry.
+ double time = gameTime.TotalGameTime.TotalSeconds;
+
+ float pulsate = (float)Math.Sin(time * 6) + 1;
+
+ float scale = 1 + pulsate * 0.05f * selectionFade;
+
+ // Modify the alpha to fade text out during transitions.
+ color *= screen.TransitionAlpha;
+
+ // Draw text, centered on the middle of each line.
+ ScreenManager screenManager = screen.ScreenManager;
+ SpriteBatch spriteBatch = screenManager.SpriteBatch;
+ SpriteFont font = screenManager.Font;
+
+ Vector2 origin = new Vector2(0, font.LineSpacing / 2);
+
+ spriteBatch.DrawString(font, text, position, color, 0,
+ origin, scale, SpriteEffects.None, 0);
+ }
+
+
+ ///
+ /// Queries how much space this menu entry requires.
+ ///
+ public virtual int GetHeight(MenuScreen screen)
+ {
+ return screen.ScreenManager.Font.LineSpacing;
+ }
+
+
+ ///
+ /// Queries how wide the entry is, used for centering on the screen.
+ ///
+ public virtual int GetWidth(MenuScreen screen)
+ {
+ return (int)screen.ScreenManager.Font.MeasureString(Text).X;
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/MenuScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/MenuScreen.cs
new file mode 100644
index 00000000..87c58daf
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/MenuScreen.cs
@@ -0,0 +1,243 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// MenuScreen.cs
+//
+// XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input.Touch;
+using Microsoft.Xna.Framework.Input;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// Base class for screens that contain a menu of options. The user can
+/// move up and down to select an entry, or cancel to back out of the screen.
+///
+abstract class MenuScreen : GameScreen
+{
+ #region Fields
+
+ List menuEntries = new List();
+ int selectedEntry = 0;
+ string menuTitle;
+
+ #endregion
+
+ #region Properties
+
+
+ ///
+ /// Gets the list of menu entries, so derived classes can add
+ /// or change the menu contents.
+ ///
+ protected IList MenuEntries
+ {
+ get { return menuEntries; }
+ }
+
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructor.
+ ///
+ public MenuScreen(string menuTitle)
+ {
+ this.menuTitle = menuTitle;
+
+ TransitionOnTime = TimeSpan.FromSeconds(0.5);
+ TransitionOffTime = TimeSpan.FromSeconds(0.5);
+ }
+
+
+ #endregion
+
+ #region Handle Input
+
+
+ ///
+ /// Responds to user input, changing the selected entry and accepting
+ /// or cancelling the menu.
+ ///
+ public override void HandleInput(InputState input)
+ {
+ // Move to the previous menu entry?
+ if (input.IsMenuUp(ControllingPlayer))
+ {
+ selectedEntry--;
+
+ if (selectedEntry < 0)
+ selectedEntry = menuEntries.Count - 1;
+ }
+
+ // Move to the next menu entry?
+ if (input.IsMenuDown(ControllingPlayer))
+ {
+ selectedEntry++;
+
+ if (selectedEntry >= menuEntries.Count)
+ selectedEntry = 0;
+ }
+
+ // Accept or cancel the menu? We pass in our ControllingPlayer, which may
+ // either be null (to accept input from any player) or a specific index.
+ // If we pass a null controlling player, the InputState helper returns to
+ // us which player actually provided the input. We pass that through to
+ // OnSelectEntry and OnCancel, so they can tell which player triggered them.
+ PlayerIndex playerIndex;
+
+ if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
+ {
+ OnSelectEntry(selectedEntry, playerIndex);
+ }
+ else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
+ {
+ OnCancel(playerIndex);
+ }
+ }
+
+
+ ///
+ /// Handler for when the user has chosen a menu entry.
+ ///
+ protected virtual void OnSelectEntry(int entryIndex, PlayerIndex playerIndex)
+ {
+ menuEntries[entryIndex].OnSelectEntry(playerIndex);
+ }
+
+
+ ///
+ /// Handler for when the user has cancelled the menu.
+ ///
+ protected virtual void OnCancel(PlayerIndex playerIndex)
+ {
+ ExitScreen();
+ }
+
+
+ ///
+ /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler.
+ ///
+ protected void OnCancel(object sender, PlayerIndexEventArgs e)
+ {
+ OnCancel(e.PlayerIndex);
+ }
+
+
+ #endregion
+
+ #region Update and Draw
+
+
+ ///
+ /// Allows the screen the chance to position the menu entries. By default
+ /// all menu entries are lined up in a vertical list, centered on the screen.
+ ///
+ protected virtual void UpdateMenuEntryLocations()
+ {
+ // Make the menu slide into place during transitions, using a
+ // power curve to make things look more interesting (this makes
+ // the movement slow down as it nears the end).
+ float transitionOffset = (float)Math.Pow(TransitionPosition, 2);
+
+ // start at Y = 175; each X value is generated per entry
+ Vector2 position = new Vector2(0f, 175f);
+
+ // update each menu entry's location in turn
+ for (int i = 0; i < menuEntries.Count; i++)
+ {
+ MenuEntry menuEntry = menuEntries[i];
+
+ // each entry is to be centered horizontally
+ position.X = ScreenManager.GraphicsDevice.Viewport.Width / 2 - menuEntry.GetWidth(this) / 2;
+
+ if (ScreenState == ScreenState.TransitionOn)
+ position.X -= transitionOffset * 256;
+ else
+ position.X += transitionOffset * 512;
+
+ // set the entry's position
+ menuEntry.Position = position;
+
+ // move down for the next entry the size of this entry
+ position.Y += menuEntry.GetHeight(this);
+ }
+ }
+
+
+ ///
+ /// Updates the menu.
+ ///
+ public override void Update(GameTime gameTime, bool otherScreenHasFocus,
+ bool coveredByOtherScreen)
+ {
+ base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
+
+ // Update each nested MenuEntry object.
+ for (int i = 0; i < menuEntries.Count; i++)
+ {
+ bool isSelected = IsActive && (i == selectedEntry);
+
+ menuEntries[i].Update(this, isSelected, gameTime);
+ }
+ }
+
+
+ ///
+ /// Draws the menu.
+ ///
+ public override void Draw(GameTime gameTime)
+ {
+ // make sure our entries are in the right place before we draw them
+ UpdateMenuEntryLocations();
+
+ GraphicsDevice graphics = ScreenManager.GraphicsDevice;
+ SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
+ SpriteFont font = ScreenManager.Font;
+
+ spriteBatch.Begin();
+
+ // Draw each menu entry in turn.
+ for (int i = 0; i < menuEntries.Count; i++)
+ {
+ MenuEntry menuEntry = menuEntries[i];
+
+ bool isSelected = IsActive && (i == selectedEntry);
+
+ menuEntry.Draw(this, isSelected, gameTime);
+ }
+
+ // Make the menu slide into place during transitions, using a
+ // power curve to make things look more interesting (this makes
+ // the movement slow down as it nears the end).
+ float transitionOffset = (float)Math.Pow(TransitionPosition, 2);
+
+ // Draw the menu title centered on the screen
+ Vector2 titlePosition = new Vector2(graphics.Viewport.Width / 2, 80);
+ Vector2 titleOrigin = font.MeasureString(menuTitle) / 2;
+ Color titleColor = new Color(192, 192, 192) * TransitionAlpha;
+ float titleScale = 1.25f;
+
+ titlePosition.Y -= transitionOffset * 100;
+
+ spriteBatch.DrawString(font, menuTitle, titlePosition, titleColor, 0,
+ titleOrigin, titleScale, SpriteEffects.None, 0);
+
+ spriteBatch.End();
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/MessageBoxScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/MessageBoxScreen.cs
new file mode 100644
index 00000000..ed113d1a
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/MessageBoxScreen.cs
@@ -0,0 +1,169 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// MessageBoxScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// A popup message box screen, used to display "are you sure?"
+/// confirmation messages.
+///
+class MessageBoxScreen : GameScreen
+{
+ #region Fields
+
+ string message;
+ Texture2D gradientTexture;
+
+ #endregion
+
+ #region Events
+
+ public event EventHandler Accepted;
+ public event EventHandler Cancelled;
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructor automatically includes the standard "A=ok, B=cancel"
+ /// usage text prompt.
+ ///
+ public MessageBoxScreen(string message)
+ : this(message, true)
+ { }
+
+
+ ///
+ /// Constructor lets the caller specify whether to include the standard
+ /// "A=ok, B=cancel" usage text prompt.
+ ///
+ public MessageBoxScreen(string message, bool includeUsageText)
+ {
+ const string usageText = "\nA button, Space, Enter = ok" +
+ "\nB button, Esc = cancel";
+
+ if (includeUsageText)
+ this.message = message + usageText;
+ else
+ this.message = message;
+
+ IsPopup = true;
+
+ TransitionOnTime = TimeSpan.FromSeconds(0.2);
+ TransitionOffTime = TimeSpan.FromSeconds(0.2);
+ }
+
+
+ ///
+ /// Loads graphics content for this screen. This uses the shared ContentManager
+ /// provided by the Game class, so the content will remain loaded forever.
+ /// Whenever a subsequent MessageBoxScreen tries to load this same content,
+ /// it will just get back another reference to the already loaded data.
+ ///
+ public override void LoadContent()
+ {
+ ContentManager content = ScreenManager.Game.Content;
+
+ gradientTexture = content.Load("Sprites/gradient");
+ }
+
+
+ #endregion
+
+ #region Handle Input
+
+
+ ///
+ /// Responds to user input, accepting or cancelling the message box.
+ ///
+ public override void HandleInput(InputState input)
+ {
+ PlayerIndex playerIndex;
+
+ // We pass in our ControllingPlayer, which may either be null (to
+ // accept input from any player) or a specific index. If we pass a null
+ // controlling player, the InputState helper returns to us which player
+ // actually provided the input. We pass that through to our Accepted and
+ // Cancelled events, so they can tell which player triggered them.
+ if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
+ {
+ // Raise the accepted event, then exit the message box.
+ if (Accepted != null)
+ Accepted(this, new PlayerIndexEventArgs(playerIndex));
+
+ ExitScreen();
+ }
+ else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
+ {
+ // Raise the cancelled event, then exit the message box.
+ if (Cancelled != null)
+ Cancelled(this, new PlayerIndexEventArgs(playerIndex));
+
+ ExitScreen();
+ }
+ }
+
+
+ #endregion
+
+ #region Draw
+
+
+ ///
+ /// Draws the message box.
+ ///
+ public override void Draw(GameTime gameTime)
+ {
+ SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
+ SpriteFont font = ScreenManager.Font;
+
+ // Darken down any other screens that were drawn beneath the popup.
+ ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);
+
+ // Center the message text in the viewport.
+ Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
+ Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
+ Vector2 textSize = font.MeasureString(message);
+ Vector2 textPosition = (viewportSize - textSize) / 2;
+
+ // The background includes a border somewhat larger than the text itself.
+ const int hPad = 32;
+ const int vPad = 16;
+
+ Rectangle backgroundRectangle = new Rectangle((int)textPosition.X - hPad,
+ (int)textPosition.Y - vPad,
+ (int)textSize.X + hPad * 2,
+ (int)textSize.Y + vPad * 2);
+
+ // Fade the popup alpha during transitions.
+ Color color = Color.White * TransitionAlpha;
+
+ spriteBatch.Begin();
+
+ // Draw the background rectangle.
+ spriteBatch.Draw(gradientTexture, backgroundRectangle, color);
+
+ // Draw the message box text.
+ spriteBatch.DrawString(font, message, textPosition, color);
+
+ spriteBatch.End();
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/OptionsMenuScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/OptionsMenuScreen.cs
new file mode 100644
index 00000000..949cda29
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/OptionsMenuScreen.cs
@@ -0,0 +1,148 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// OptionsMenuScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using Microsoft.Xna.Framework;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// The options screen is brought up over the top of the main menu
+/// screen, and gives the user a chance to configure the game
+/// in various hopefully useful ways.
+///
+class OptionsMenuScreen : MenuScreen
+{
+ #region Fields
+
+ MenuEntry ungulateMenuEntry;
+ MenuEntry languageMenuEntry;
+ MenuEntry frobnicateMenuEntry;
+ MenuEntry elfMenuEntry;
+
+ enum Ungulate
+ {
+ BactrianCamel,
+ Dromedary,
+ Llama,
+ }
+
+ static Ungulate currentUngulate = Ungulate.Dromedary;
+
+ static string[] languages = { "C#", "French", "Deoxyribonucleic acid" };
+ static int currentLanguage = 0;
+
+ static bool frobnicate = true;
+
+ static int elf = 23;
+
+ #endregion
+
+ #region Initialization
+
+
+ ///
+ /// Constructor.
+ ///
+ public OptionsMenuScreen()
+ : base("Options")
+ {
+ // Create our menu entries.
+ ungulateMenuEntry = new MenuEntry(string.Empty);
+ languageMenuEntry = new MenuEntry(string.Empty);
+ frobnicateMenuEntry = new MenuEntry(string.Empty);
+ elfMenuEntry = new MenuEntry(string.Empty);
+
+ SetMenuEntryText();
+
+ MenuEntry back = new MenuEntry("Back");
+
+ // Hook up menu event handlers.
+ ungulateMenuEntry.Selected += UngulateMenuEntrySelected;
+ languageMenuEntry.Selected += LanguageMenuEntrySelected;
+ frobnicateMenuEntry.Selected += FrobnicateMenuEntrySelected;
+ elfMenuEntry.Selected += ElfMenuEntrySelected;
+ back.Selected += OnCancel;
+
+ // Add entries to the menu.
+ MenuEntries.Add(ungulateMenuEntry);
+ MenuEntries.Add(languageMenuEntry);
+ MenuEntries.Add(frobnicateMenuEntry);
+ MenuEntries.Add(elfMenuEntry);
+ MenuEntries.Add(back);
+ }
+
+
+ ///
+ /// Fills in the latest values for the options screen menu text.
+ ///
+ void SetMenuEntryText()
+ {
+ ungulateMenuEntry.Text = "Preferred ungulate: " + currentUngulate;
+ languageMenuEntry.Text = "Language: " + languages[currentLanguage];
+ frobnicateMenuEntry.Text = "Frobnicate: " + (frobnicate ? "on" : "off");
+ elfMenuEntry.Text = "elf: " + elf;
+ }
+
+
+ #endregion
+
+ #region Handle Input
+
+
+ ///
+ /// Event handler for when the Ungulate menu entry is selected.
+ ///
+ void UngulateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ currentUngulate++;
+
+ if (currentUngulate > Ungulate.Llama)
+ currentUngulate = 0;
+
+ SetMenuEntryText();
+ }
+
+
+ ///
+ /// Event handler for when the Language menu entry is selected.
+ ///
+ void LanguageMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ currentLanguage = (currentLanguage + 1) % languages.Length;
+
+ SetMenuEntryText();
+ }
+
+
+ ///
+ /// Event handler for when the Frobnicate menu entry is selected.
+ ///
+ void FrobnicateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ frobnicate = !frobnicate;
+
+ SetMenuEntryText();
+ }
+
+
+ ///
+ /// Event handler for when the Elf menu entry is selected.
+ ///
+ void ElfMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ elf++;
+
+ SetMenuEntryText();
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/PauseMenuScreen.cs b/GameStateManagement/GameStateManagement.Core/Screens/PauseMenuScreen.cs
new file mode 100644
index 00000000..625655ec
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/PauseMenuScreen.cs
@@ -0,0 +1,78 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// PauseMenuScreen.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using Microsoft.Xna.Framework;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// The pause menu comes up over the top of the game,
+/// giving the player options to resume or quit.
+///
+class PauseMenuScreen : MenuScreen
+{
+ #region Initialization
+
+
+ ///
+ /// Constructor.
+ ///
+ public PauseMenuScreen()
+ : base("Paused")
+ {
+ // Create our menu entries.
+ MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
+ MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
+
+ // Hook up menu event handlers.
+ resumeGameMenuEntry.Selected += OnCancel;
+ quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
+
+ // Add entries to the menu.
+ MenuEntries.Add(resumeGameMenuEntry);
+ MenuEntries.Add(quitGameMenuEntry);
+ }
+
+
+ #endregion
+
+ #region Handle Input
+
+
+ ///
+ /// Event handler for when the Quit Game menu entry is selected.
+ ///
+ void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
+ {
+ const string message = "Are you sure you want to quit this game?";
+
+ MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);
+
+ confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
+
+ ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
+ }
+
+
+ ///
+ /// Event handler for when the user selects ok on the "are you sure
+ /// you want to quit" message box. This uses the loading screen to
+ /// transition from the game back to the main menu screen.
+ ///
+ void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
+ {
+ LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
+ new MainMenuScreen());
+ }
+
+
+ #endregion
+}
diff --git a/GameStateManagement/GameStateManagement.Core/Screens/PlayerIndexEventArgs.cs b/GameStateManagement/GameStateManagement.Core/Screens/PlayerIndexEventArgs.cs
new file mode 100644
index 00000000..0c602970
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.Core/Screens/PlayerIndexEventArgs.cs
@@ -0,0 +1,41 @@
+#region File Description
+//-----------------------------------------------------------------------------
+// PlayerIndexEventArgs.cs
+//
+// XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+#endregion
+
+#region Using Statements
+using System;
+using Microsoft.Xna.Framework;
+#endregion
+
+namespace GameStateManagement.Core;
+
+///
+/// Custom event argument which includes the index of the player who
+/// triggered the event. This is used by the MenuEntry.Selected event.
+///
+class PlayerIndexEventArgs : EventArgs
+{
+ ///
+ /// Constructor.
+ ///
+ public PlayerIndexEventArgs(PlayerIndex playerIndex)
+ {
+ this.playerIndex = playerIndex;
+ }
+
+
+ ///
+ /// Gets the index of the player who triggered this event.
+ ///
+ public PlayerIndex PlayerIndex
+ {
+ get { return playerIndex; }
+ }
+
+ PlayerIndex playerIndex;
+}
diff --git a/GameStateManagement/GameStateManagement.DesktopGL/GameStateManagement.DesktopGL.csproj b/GameStateManagement/GameStateManagement.DesktopGL/GameStateManagement.DesktopGL.csproj
new file mode 100644
index 00000000..23b1cf2f
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.DesktopGL/GameStateManagement.DesktopGL.csproj
@@ -0,0 +1,37 @@
+
+
+ WinExe
+ net8.0
+ false
+ false
+
+
+ app.manifest
+ ../GameStateManagement.Core/Content/Icon.ico
+
+
+
+ Content\GameStateManagement.mgcb
+
+
+ Icon.ico
+
+
+ Icon.bmp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.DesktopGL/Program.cs b/GameStateManagement/GameStateManagement.DesktopGL/Program.cs
new file mode 100644
index 00000000..4a17b182
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.DesktopGL/Program.cs
@@ -0,0 +1,5 @@
+
+using GameStateManagement.Core;
+
+using var game = new GameStateManagementGame();
+game.Run();
diff --git a/GameStateManagement/GameStateManagement.DesktopGL/app.manifest b/GameStateManagement/GameStateManagement.DesktopGL/app.manifest
new file mode 100644
index 00000000..0f8c36f4
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.DesktopGL/app.manifest
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true/pm
+ permonitorv2,permonitor
+
+
+
+
diff --git a/GameStateManagement/GameStateManagement.MacOS.csproj b/GameStateManagement/GameStateManagement.MacOS.csproj
deleted file mode 100644
index adfadc61..00000000
--- a/GameStateManagement/GameStateManagement.MacOS.csproj
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.0
- 2.0
- {4AD6BC7A-DB9A-4A6F-9EE2-DAD9B0BBA2A8}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Exe
- GameStateManagement
- GameStateManagement
- True
-
-
- True
- full
- False
- bin\Debug
- DEBUG;MONOMAC
- prompt
- 4
- False
- False
- False
- False
- False
- False
-
-
- none
- False
- bin\Release
- prompt
- 4
- False
- MONOMAC
- False
- False
- False
- False
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
-
diff --git a/GameStateManagement/GameStateManagement.WindowsDX/GameStateManagement.WindowsDX.csproj b/GameStateManagement/GameStateManagement.WindowsDX/GameStateManagement.WindowsDX.csproj
new file mode 100644
index 00000000..a81be304
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.WindowsDX/GameStateManagement.WindowsDX.csproj
@@ -0,0 +1,36 @@
+
+
+ WinExe
+ net8.0-windows
+ Major
+ false
+ false
+ true
+
+
+ app.manifest
+ ../GameStateManagement.Core/Content/Icon.ico
+
+
+ $(DefineConstants);DIRECTX
+
+
+ $(DefineConstants);DIRECTX
+
+
+
+ Content\GameStateManagement.mgcb
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.WindowsDX/Program.cs b/GameStateManagement/GameStateManagement.WindowsDX/Program.cs
new file mode 100644
index 00000000..5d4c8453
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.WindowsDX/Program.cs
@@ -0,0 +1,7 @@
+
+using GameStateManagement.Core;
+using System.Windows.Forms;
+
+Application.SetHighDpiMode(HighDpiMode.SystemAware); // Adjust the mode as needed
+using var game = new GameStateManagementGame();
+game.Run();
diff --git a/GameStateManagement/GameStateManagement.WindowsDX/app.manifest b/GameStateManagement/GameStateManagement.WindowsDX/app.manifest
new file mode 100644
index 00000000..abe1ee48
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.WindowsDX/app.manifest
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GameStateManagement/GameStateManagement.iOS.csproj b/GameStateManagement/GameStateManagement.iOS.csproj
deleted file mode 100644
index 22958758..00000000
--- a/GameStateManagement/GameStateManagement.iOS.csproj
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
- {B1A596F8-B26C-4826-99D1-94C9327AB586}
- {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Debug
- iPhoneSimulator
- 9.0.21022
- 2.0
- Exe
- Properties
- GameStateManagement
- GameThumbnail.png
-
-
- True
- full
- False
- bin\iPhoneSimulator\Debug
- DEBUG;IPHONE
- prompt
- 4
- True
- None
- True
-
- false
- GameStateManagement
-
-
- none
- True
- bin\iPhoneSimulator\Release
- prompt
- IPHONE
- 4
-
- false
- GameStateManagement
-
-
- True
- full
- False
- bin\iPhone\Debug
- DEBUG;IPHONE
- prompt
- 4
- True
-
- 4.0
- false
- GameStateManagement
-
-
- none
- True
- bin\iPhone\Release
- IPHONE
- prompt
- 4
-
- iPhone Developer
- 4.0
- false
- GameStateManagement
-
-
- none
- False
- bin\Debug
- 4
- MonoGameSamplesGameStateManagement
- false
-
-
- none
- False
- bin\Release
- 4
- MonoGameSamplesGameStateManagement
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
-
diff --git a/GameStateManagement/GameStateManagement.iOS/Default.png b/GameStateManagement/GameStateManagement.iOS/Default.png
new file mode 100644
index 00000000..1f9b909f
Binary files /dev/null and b/GameStateManagement/GameStateManagement.iOS/Default.png differ
diff --git a/GameStateManagement/GameStateManagement.iOS/Entitlements.plist b/GameStateManagement/GameStateManagement.iOS/Entitlements.plist
new file mode 100644
index 00000000..9ae59937
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.iOS/Entitlements.plist
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/GameStateManagement/GameStateManagement.iOS/GameStateManagement.iOS.csproj b/GameStateManagement/GameStateManagement.iOS/GameStateManagement.iOS.csproj
new file mode 100644
index 00000000..aee2fa11
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.iOS/GameStateManagement.iOS.csproj
@@ -0,0 +1,30 @@
+
+
+ net8.0-ios
+ Exe
+ 11.2
+ iPhone Developer
+
+
+ false
+
+
+ false
+
+
+
+ Content\GameStateManagement.mgcb
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.iOS/GameThumbnail.png b/GameStateManagement/GameStateManagement.iOS/GameThumbnail.png
new file mode 100644
index 00000000..99814c32
Binary files /dev/null and b/GameStateManagement/GameStateManagement.iOS/GameThumbnail.png differ
diff --git a/GameStateManagement/GameStateManagement.iOS/Info.plist b/GameStateManagement/GameStateManagement.iOS/Info.plist
new file mode 100644
index 00000000..4bb6d66e
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.iOS/Info.plist
@@ -0,0 +1,34 @@
+
+
+
+
+ CFBundleIconFiles
+
+ monogameicon.png
+
+ MinimumOSVersion
+ 11.2
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ CFBundleName
+ ___SafeGameName___
+ UIRequiresFullScreen
+
+ UIStatusBarHidden
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIDeviceFamily
+
+ 1
+ 2
+
+ CFBundleIdentifier
+ com.companyname.___SafeGameName___.iOS
+ CFBundleDisplayName
+ ___SafeGameName___
+
+
diff --git a/GameStateManagement/GameStateManagement.iOS/LaunchScreen.storyboard b/GameStateManagement/GameStateManagement.iOS/LaunchScreen.storyboard
new file mode 100644
index 00000000..5d2e905a
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.iOS/LaunchScreen.storyboard
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GameStateManagement/GameStateManagement.iOS/Program.cs b/GameStateManagement/GameStateManagement.iOS/Program.cs
new file mode 100644
index 00000000..ed655412
--- /dev/null
+++ b/GameStateManagement/GameStateManagement.iOS/Program.cs
@@ -0,0 +1,43 @@
+//-----------------------------------------------------------------------------
+// Program.cs
+//
+// MonoGame Foundation Game Platform
+// Copyright (C) MonoGame Foundation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+#region Using Statements
+using System;
+
+using Foundation;
+using UIKit;
+
+using GameStateManagement.Core;
+
+#endregion
+
+namespace GameStateManagement.iOS;
+
+[Register("AppDelegate")]
+internal class Program : UIApplicationDelegate
+{
+ private static GameStateManagementGame game;
+
+ internal static void RunGame()
+ {
+ game = new GameStateManagementGame();
+ game.Run();
+ }
+
+ ///
+ /// The main entry point for the application.
+ ///
+ static void Main(string[] args)
+ {
+ UIApplication.Main(args, null, typeof(Program));
+ }
+
+ public override void FinishedLaunching(UIApplication app)
+ {
+ RunGame();
+ }
+}
\ No newline at end of file
diff --git a/GameStateManagement/GameStateManagement.iOS/monogameicon.png b/GameStateManagement/GameStateManagement.iOS/monogameicon.png
new file mode 100644
index 00000000..25bcd9b9
Binary files /dev/null and b/GameStateManagement/GameStateManagement.iOS/monogameicon.png differ
diff --git a/GameStateManagement/GameStateManagement.sln b/GameStateManagement/GameStateManagement.sln
index 95a58580..2f9403f3 100644
--- a/GameStateManagement/GameStateManagement.sln
+++ b/GameStateManagement/GameStateManagement.sln
@@ -1,27 +1,80 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameStateManagement", "GameStateManagement.csproj", "{4AD6BC7A-DB9A-4A6F-9EE2-DAD9B0BBA2A8}"
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.11.35303.130
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameStateManagement.Core", "GameStateManagement.Core\GameStateManagement.Core.csproj", "{3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Framework.MacOS", "..\..\..\..\..\..\..\Users\Jimmy\Public\Share\MonoMacSource\kjpgit\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj", "{36C538E6-C32A-4A8D-A39C-566173D7118E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameStateManagement.Android", "GameStateManagement.Android\GameStateManagement.Android.csproj", "{A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameStateManagement.DesktopGL", "GameStateManagement.DesktopGL\GameStateManagement.DesktopGL.csproj", "{E44EFCD8-9817-400F-986E-3D6D1662C893}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameStateManagement.iOS", "GameStateManagement.iOS\GameStateManagement.iOS.csproj", "{DAD2DB5F-4D9C-4CAA-9995-A006E8131871}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameStateManagement.WindowsDX", "GameStateManagement.WindowsDX\GameStateManagement.WindowsDX.csproj", "{DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
- Distribution|Any CPU = Distribution|Any CPU
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.ActiveCfg = Distribution|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.Build.0 = Distribution|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.Build.0 = Release|Any CPU
- {4AD6BC7A-DB9A-4A6F-9EE2-DAD9B0BBA2A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4AD6BC7A-DB9A-4A6F-9EE2-DAD9B0BBA2A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4AD6BC7A-DB9A-4A6F-9EE2-DAD9B0BBA2A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4AD6BC7A-DB9A-4A6F-9EE2-DAD9B0BBA2A8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Debug|x64.ActiveCfg = Debug|x64
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Debug|x64.Build.0 = Debug|x64
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Release|x64.ActiveCfg = Release|x64
+ {3AFC4E10-5EE4-473A-A7E2-8BF5415FD71F}.Release|x64.Build.0 = Release|x64
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Debug|x64.Build.0 = Debug|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Debug|x64.Deploy.0 = Debug|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Release|x64.ActiveCfg = Release|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Release|x64.Build.0 = Release|Any CPU
+ {A4F8DC31-360E-4AFA-A474-6D01EEBC0D19}.Release|x64.Deploy.0 = Release|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Debug|x64.Build.0 = Debug|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Release|x64.ActiveCfg = Release|Any CPU
+ {E44EFCD8-9817-400F-986E-3D6D1662C893}.Release|x64.Build.0 = Release|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Debug|x64.Build.0 = Debug|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Debug|x64.Deploy.0 = Debug|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Release|x64.ActiveCfg = Release|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Release|x64.Build.0 = Release|Any CPU
+ {DAD2DB5F-4D9C-4CAA-9995-A006E8131871}.Release|x64.Deploy.0 = Release|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Debug|x64.Build.0 = Debug|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Release|x64.ActiveCfg = Release|Any CPU
+ {DC9D9B21-AD23-48E5-A248-4EBE90FEABF8}.Release|x64.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1EE8FFCD-ED3E-42F3-BD4B-E36697DC7385}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = GameStateManagement.csproj
diff --git a/GameStateManagement/Program.cs b/GameStateManagement/Program.cs
index 19b38161..37978e78 100755
--- a/GameStateManagement/Program.cs
+++ b/GameStateManagement/Program.cs
@@ -1,14 +1,14 @@
#region Using Statements
using System;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Microsoft.Xna;
using Microsoft.Xna.Framework.Media;
-#elif MONOMAC
+#elif __MACOS__
#endif
#endregion
@@ -16,7 +16,7 @@
namespace GameStateManagement
{
#region Entry Point
-#if MONOMAC
+#if __MACOS__
class Program
{
static void Main (string[] args)
@@ -35,7 +35,7 @@ class AppDelegate : NSApplicationDelegate
{
private GameStateManagementGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new GameStateManagementGame ();
game.Run();
@@ -66,7 +66,7 @@ static void Main(string[] args)
UIApplication.Main(args, null, "AppDelegate");
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -74,24 +74,24 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
var game = new GameStateManagementGame();
game.Run();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/GameStateManagement/Properties/AssemblyInfo.cs b/GameStateManagement/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
index bca67005..ab10975d
--- a/GameStateManagement/Properties/AssemblyInfo.cs
+++ b/GameStateManagement/Properties/AssemblyInfo.cs
@@ -1,33 +1,33 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Game State Management")]
-[assembly: AssemblyProduct("Game State Management")]
-[assembly: AssemblyDescription("This sample shows how to manage the transitions between different menus and gameplay states.")]
-[assembly: AssemblyCompany("Microsoft")]
-
-[assembly: AssemblyCopyright("Copyright © Microsoft 2007")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("d2049bb7-2a0a-4c44-bb6f-4580d47c64fe")]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Game State Management")]
+[assembly: AssemblyProduct("Game State Management")]
+[assembly: AssemblyDescription("This sample shows how to manage the transitions between different menus and gameplay states.")]
+[assembly: AssemblyCompany("Microsoft")]
+
+[assembly: AssemblyCopyright("Copyright © Microsoft 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("d2049bb7-2a0a-4c44-bb6f-4580d47c64fe")]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/GameStateManagement/ScreenManager/GameScreen.cs b/GameStateManagement/ScreenManager/GameScreen.cs
deleted file mode 100755
index ae033ad0..00000000
--- a/GameStateManagement/ScreenManager/GameScreen.cs
+++ /dev/null
@@ -1,356 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// GameScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input.Touch;
-using System.IO;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// Enum describes the screen transition state.
- ///
- public enum ScreenState
- {
- TransitionOn,
- Active,
- TransitionOff,
- Hidden,
- }
-
-
- ///
- /// A screen is a single layer that has update and draw logic, and which
- /// can be combined with other layers to build up a complex menu system.
- /// For instance the main menu, the options menu, the "are you sure you
- /// want to quit" message box, and the main game itself are all implemented
- /// as screens.
- ///
- public abstract class GameScreen
- {
- #region Properties
-
-
- ///
- /// Normally when one screen is brought up over the top of another,
- /// the first screen will transition off to make room for the new
- /// one. This property indicates whether the screen is only a small
- /// popup, in which case screens underneath it do not need to bother
- /// transitioning off.
- ///
- public bool IsPopup
- {
- get { return isPopup; }
- protected set { isPopup = value; }
- }
-
- bool isPopup = false;
-
-
- ///
- /// Indicates how long the screen takes to
- /// transition on when it is activated.
- ///
- public TimeSpan TransitionOnTime
- {
- get { return transitionOnTime; }
- protected set { transitionOnTime = value; }
- }
-
- TimeSpan transitionOnTime = TimeSpan.Zero;
-
-
- ///
- /// Indicates how long the screen takes to
- /// transition off when it is deactivated.
- ///
- public TimeSpan TransitionOffTime
- {
- get { return transitionOffTime; }
- protected set { transitionOffTime = value; }
- }
-
- TimeSpan transitionOffTime = TimeSpan.Zero;
-
-
- ///
- /// Gets the current position of the screen transition, ranging
- /// from zero (fully active, no transition) to one (transitioned
- /// fully off to nothing).
- ///
- public float TransitionPosition
- {
- get { return transitionPosition; }
- protected set { transitionPosition = value; }
- }
-
- float transitionPosition = 1;
-
-
- ///
- /// Gets the current alpha of the screen transition, ranging
- /// from 1 (fully active, no transition) to 0 (transitioned
- /// fully off to nothing).
- ///
- public float TransitionAlpha
- {
- get { return 1f - TransitionPosition; }
- }
-
-
- ///
- /// Gets the current screen transition state.
- ///
- public ScreenState ScreenState
- {
- get { return screenState; }
- protected set { screenState = value; }
- }
-
- ScreenState screenState = ScreenState.TransitionOn;
-
-
- ///
- /// There are two possible reasons why a screen might be transitioning
- /// off. It could be temporarily going away to make room for another
- /// screen that is on top of it, or it could be going away for good.
- /// This property indicates whether the screen is exiting for real:
- /// if set, the screen will automatically remove itself as soon as the
- /// transition finishes.
- ///
- public bool IsExiting
- {
- get { return isExiting; }
- protected internal set { isExiting = value; }
- }
-
- bool isExiting = false;
-
-
- ///
- /// Checks whether this screen is active and can respond to user input.
- ///
- public bool IsActive
- {
- get
- {
- return !otherScreenHasFocus &&
- (screenState == ScreenState.TransitionOn ||
- screenState == ScreenState.Active);
- }
- }
-
- bool otherScreenHasFocus;
-
-
- ///
- /// Gets the manager that this screen belongs to.
- ///
- public ScreenManager ScreenManager
- {
- get { return screenManager; }
- internal set { screenManager = value; }
- }
-
- ScreenManager screenManager;
-
-
- ///
- /// Gets the index of the player who is currently controlling this screen,
- /// or null if it is accepting input from any player. This is used to lock
- /// the game to a specific player profile. The main menu responds to input
- /// from any connected gamepad, but whichever player makes a selection from
- /// this menu is given control over all subsequent screens, so other gamepads
- /// are inactive until the controlling player returns to the main menu.
- ///
- public PlayerIndex? ControllingPlayer
- {
- get { return controllingPlayer; }
- internal set { controllingPlayer = value; }
- }
-
- PlayerIndex? controllingPlayer;
-
-
- ///
- /// Gets the gestures the screen is interested in. Screens should be as specific
- /// as possible with gestures to increase the accuracy of the gesture engine.
- /// For example, most menus only need Tap or perhaps Tap and VerticalDrag to operate.
- /// These gestures are handled by the ScreenManager when screens change and
- /// all gestures are placed in the InputState passed to the HandleInput method.
- ///
- public GestureType EnabledGestures
- {
- get { return enabledGestures; }
- protected set
- {
- enabledGestures = value;
-
- // the screen manager handles this during screen changes, but
- // if this screen is active and the gesture types are changing,
- // we have to update the TouchPanel ourself.
- if (ScreenState == ScreenState.Active)
- {
- TouchPanel.EnabledGestures = value;
- }
- }
- }
-
- GestureType enabledGestures = GestureType.None;
-
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Load graphics content for the screen.
- ///
- public virtual void LoadContent() { }
-
-
- ///
- /// Unload content for the screen.
- ///
- public virtual void UnloadContent() { }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Allows the screen to run logic, such as updating the transition position.
- /// Unlike HandleInput, this method is called regardless of whether the screen
- /// is active, hidden, or in the middle of a transition.
- ///
- public virtual void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- this.otherScreenHasFocus = otherScreenHasFocus;
-
- if (isExiting)
- {
- // If the screen is going away to die, it should transition off.
- screenState = ScreenState.TransitionOff;
-
- if (!UpdateTransition(gameTime, transitionOffTime, 1))
- {
- // When the transition finishes, remove the screen.
- ScreenManager.RemoveScreen(this);
- }
- }
- else if (coveredByOtherScreen)
- {
- // If the screen is covered by another, it should transition off.
- if (UpdateTransition(gameTime, transitionOffTime, 1))
- {
- // Still busy transitioning.
- screenState = ScreenState.TransitionOff;
- }
- else
- {
- // Transition finished!
- screenState = ScreenState.Hidden;
- }
- }
- else
- {
- // Otherwise the screen should transition on and become active.
- if (UpdateTransition(gameTime, transitionOnTime, -1))
- {
- // Still busy transitioning.
- screenState = ScreenState.TransitionOn;
- }
- else
- {
- // Transition finished!
- screenState = ScreenState.Active;
- }
- }
- }
-
-
- ///
- /// Helper for updating the screen transition position.
- ///
- bool UpdateTransition(GameTime gameTime, TimeSpan time, int direction)
- {
- // How much should we move by?
- float transitionDelta;
-
- if (time == TimeSpan.Zero)
- transitionDelta = 1;
- else
- transitionDelta = (float)(gameTime.ElapsedGameTime.TotalMilliseconds /
- time.TotalMilliseconds);
-
- // Update the transition position.
- transitionPosition += transitionDelta * direction;
-
- // Did we reach the end of the transition?
- if (((direction < 0) && (transitionPosition <= 0)) ||
- ((direction > 0) && (transitionPosition >= 1)))
- {
- transitionPosition = MathHelper.Clamp(transitionPosition, 0, 1);
- return false;
- }
-
- // Otherwise we are still busy transitioning.
- return true;
- }
-
-
- ///
- /// Allows the screen to handle user input. Unlike Update, this method
- /// is only called when the screen is active, and not when some other
- /// screen has taken the focus.
- ///
- public virtual void HandleInput(InputState input) { }
-
-
- ///
- /// This is called when the screen should draw itself.
- ///
- public virtual void Draw(GameTime gameTime) { }
-
-
- #endregion
-
- #region Public Methods
-
-
- ///
- /// Tells the screen to go away. Unlike ScreenManager.RemoveScreen, which
- /// instantly kills the screen, this method respects the transition timings
- /// and will give the screen a chance to gradually transition off.
- ///
- public void ExitScreen()
- {
- if (TransitionOffTime == TimeSpan.Zero)
- {
- // If the screen has a zero transition time, remove it immediately.
- ScreenManager.RemoveScreen(this);
- }
- else
- {
- // Otherwise flag that it should transition off and then exit.
- isExiting = true;
- }
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/ScreenManager/InputState.cs b/GameStateManagement/ScreenManager/InputState.cs
deleted file mode 100755
index 32e572c8..00000000
--- a/GameStateManagement/ScreenManager/InputState.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// InputState.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Input.Touch;
-using System.Collections.Generic;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// Helper for reading input from keyboard, gamepad, and touch input. This class
- /// tracks both the current and previous state of the input devices, and implements
- /// query methods for high level input actions such as "move up through the menu"
- /// or "pause the game".
- ///
- public class InputState
- {
- #region Fields
-
- public const int MaxInputs = 4;
-
- public readonly KeyboardState[] CurrentKeyboardStates;
- public readonly GamePadState[] CurrentGamePadStates;
-
- public readonly KeyboardState[] LastKeyboardStates;
- public readonly GamePadState[] LastGamePadStates;
-
- public readonly bool[] GamePadWasConnected;
-
- public TouchCollection TouchState;
-
- public readonly List Gestures = new List();
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructs a new input state.
- ///
- public InputState()
- {
- CurrentKeyboardStates = new KeyboardState[MaxInputs];
- CurrentGamePadStates = new GamePadState[MaxInputs];
-
- LastKeyboardStates = new KeyboardState[MaxInputs];
- LastGamePadStates = new GamePadState[MaxInputs];
-
- GamePadWasConnected = new bool[MaxInputs];
- }
-
-
- #endregion
-
- #region Public Methods
-
-
- ///
- /// Reads the latest state of the keyboard and gamepad.
- ///
- public void Update()
- {
- for (int i = 0; i < MaxInputs; i++)
- {
- LastKeyboardStates[i] = CurrentKeyboardStates[i];
- LastGamePadStates[i] = CurrentGamePadStates[i];
-
- CurrentKeyboardStates[i] = Keyboard.GetState((PlayerIndex)i);
- CurrentGamePadStates[i] = GamePad.GetState((PlayerIndex)i);
-
- // Keep track of whether a gamepad has ever been
- // connected, so we can detect if it is unplugged.
- if (CurrentGamePadStates[i].IsConnected)
- {
- GamePadWasConnected[i] = true;
- }
- }
-
- TouchState = TouchPanel.GetState();
-
- Gestures.Clear();
- while (TouchPanel.IsGestureAvailable)
- {
- Gestures.Add(TouchPanel.ReadGesture());
- }
- }
-
-
- ///
- /// Helper for checking if a key was newly pressed during this update. The
- /// controllingPlayer parameter specifies which player to read input for.
- /// If this is null, it will accept input from any player. When a keypress
- /// is detected, the output playerIndex reports which player pressed it.
- ///
- public bool IsNewKeyPress(Keys key, PlayerIndex? controllingPlayer,
- out PlayerIndex playerIndex)
- {
- if (controllingPlayer.HasValue)
- {
- // Read input from the specified player.
- playerIndex = controllingPlayer.Value;
-
- int i = (int)playerIndex;
-
- return (CurrentKeyboardStates[i].IsKeyDown(key) &&
- LastKeyboardStates[i].IsKeyUp(key));
- }
- else
- {
- // Accept input from any player.
- return (IsNewKeyPress(key, PlayerIndex.One, out playerIndex) ||
- IsNewKeyPress(key, PlayerIndex.Two, out playerIndex) ||
- IsNewKeyPress(key, PlayerIndex.Three, out playerIndex) ||
- IsNewKeyPress(key, PlayerIndex.Four, out playerIndex));
- }
- }
-
-
- ///
- /// Helper for checking if a button was newly pressed during this update.
- /// The controllingPlayer parameter specifies which player to read input for.
- /// If this is null, it will accept input from any player. When a button press
- /// is detected, the output playerIndex reports which player pressed it.
- ///
- public bool IsNewButtonPress(Buttons button, PlayerIndex? controllingPlayer,
- out PlayerIndex playerIndex)
- {
- if (controllingPlayer.HasValue)
- {
- // Read input from the specified player.
- playerIndex = controllingPlayer.Value;
-
- int i = (int)playerIndex;
-
- return (CurrentGamePadStates[i].IsButtonDown(button) &&
- LastGamePadStates[i].IsButtonUp(button));
- }
- else
- {
- // Accept input from any player.
- return (IsNewButtonPress(button, PlayerIndex.One, out playerIndex) ||
- IsNewButtonPress(button, PlayerIndex.Two, out playerIndex) ||
- IsNewButtonPress(button, PlayerIndex.Three, out playerIndex) ||
- IsNewButtonPress(button, PlayerIndex.Four, out playerIndex));
- }
- }
-
-
- ///
- /// Checks for a "menu select" input action.
- /// The controllingPlayer parameter specifies which player to read input for.
- /// If this is null, it will accept input from any player. When the action
- /// is detected, the output playerIndex reports which player pressed it.
- ///
- public bool IsMenuSelect(PlayerIndex? controllingPlayer,
- out PlayerIndex playerIndex)
- {
- return IsNewKeyPress(Keys.Space, controllingPlayer, out playerIndex) ||
- IsNewKeyPress(Keys.Enter, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.A, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
- }
-
-
- ///
- /// Checks for a "menu cancel" input action.
- /// The controllingPlayer parameter specifies which player to read input for.
- /// If this is null, it will accept input from any player. When the action
- /// is detected, the output playerIndex reports which player pressed it.
- ///
- public bool IsMenuCancel(PlayerIndex? controllingPlayer,
- out PlayerIndex playerIndex)
- {
- return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.B, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex);
- }
-
-
- ///
- /// Checks for a "menu up" input action.
- /// The controllingPlayer parameter specifies which player to read
- /// input for. If this is null, it will accept input from any player.
- ///
- public bool IsMenuUp(PlayerIndex? controllingPlayer)
- {
- PlayerIndex playerIndex;
-
- return IsNewKeyPress(Keys.Up, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.DPadUp, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.LeftThumbstickUp, controllingPlayer, out playerIndex);
- }
-
-
- ///
- /// Checks for a "menu down" input action.
- /// The controllingPlayer parameter specifies which player to read
- /// input for. If this is null, it will accept input from any player.
- ///
- public bool IsMenuDown(PlayerIndex? controllingPlayer)
- {
- PlayerIndex playerIndex;
-
- return IsNewKeyPress(Keys.Down, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.DPadDown, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.LeftThumbstickDown, controllingPlayer, out playerIndex);
- }
-
-
- ///
- /// Checks for a "pause the game" input action.
- /// The controllingPlayer parameter specifies which player to read
- /// input for. If this is null, it will accept input from any player.
- ///
- public bool IsPauseGame(PlayerIndex? controllingPlayer)
- {
- PlayerIndex playerIndex;
-
- return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex) ||
- IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/ScreenManager/ScreenManager.cs b/GameStateManagement/ScreenManager/ScreenManager.cs
deleted file mode 100755
index 23f8928f..00000000
--- a/GameStateManagement/ScreenManager/ScreenManager.cs
+++ /dev/null
@@ -1,315 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// ScreenManager.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using System.Diagnostics;
-using System.Collections.Generic;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input.Touch;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// The screen manager is a component which manages one or more GameScreen
- /// instances. It maintains a stack of screens, calls their Update and Draw
- /// methods at the appropriate times, and automatically routes input to the
- /// topmost active screen.
- ///
- public class ScreenManager : DrawableGameComponent
- {
- #region Fields
-
- List screens = new List();
- List screensToUpdate = new List();
-
- InputState input = new InputState();
-
- SpriteBatch spriteBatch;
- SpriteFont font;
- Texture2D blankTexture;
-
- bool isInitialized;
-
- bool traceEnabled;
-
- #endregion
-
- #region Properties
-
-
- ///
- /// A default SpriteBatch shared by all the screens. This saves
- /// each screen having to bother creating their own local instance.
- ///
- public SpriteBatch SpriteBatch
- {
- get { return spriteBatch; }
- }
-
-
- ///
- /// A default font shared by all the screens. This saves
- /// each screen having to bother loading their own local copy.
- ///
- public SpriteFont Font
- {
- get { return font; }
- }
-
-
- ///
- /// If true, the manager prints out a list of all the screens
- /// each time it is updated. This can be useful for making sure
- /// everything is being added and removed at the right times.
- ///
- public bool TraceEnabled
- {
- get { return traceEnabled; }
- set { traceEnabled = value; }
- }
-
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructs a new screen manager component.
- ///
- public ScreenManager(Game game)
- : base(game)
- {
- // we must set EnabledGestures before we can query for them, but
- // we don't assume the game wants to read them.
- TouchPanel.EnabledGestures = GestureType.None;
- }
-
-
- ///
- /// Initializes the screen manager component.
- ///
- public override void Initialize()
- {
- base.Initialize();
-
- isInitialized = true;
- }
-
-
- ///
- /// Load your graphics content.
- ///
- protected override void LoadContent()
- {
- // Load content belonging to the screen manager.
- ContentManager content = Game.Content;
-
- spriteBatch = new SpriteBatch(GraphicsDevice);
- font = content.Load("menufont");
- blankTexture = content.Load("blank");
-
- // Tell each of the screens to load their content.
- foreach (GameScreen screen in screens)
- {
- screen.LoadContent();
- }
- }
-
-
- ///
- /// Unload your graphics content.
- ///
- protected override void UnloadContent()
- {
- // Tell each of the screens to unload their content.
- foreach (GameScreen screen in screens)
- {
- screen.UnloadContent();
- }
- }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Allows each screen to run logic.
- ///
- public override void Update(GameTime gameTime)
- {
- // Read the keyboard and gamepad.
- input.Update();
-
- // Make a copy of the master screen list, to avoid confusion if
- // the process of updating one screen adds or removes others.
- screensToUpdate.Clear();
-
- foreach (GameScreen screen in screens)
- screensToUpdate.Add(screen);
-
- bool otherScreenHasFocus = !Game.IsActive;
- bool coveredByOtherScreen = false;
-
- // Loop as long as there are screens waiting to be updated.
- while (screensToUpdate.Count > 0)
- {
- // Pop the topmost screen off the waiting list.
- GameScreen screen = screensToUpdate[screensToUpdate.Count - 1];
-
- screensToUpdate.RemoveAt(screensToUpdate.Count - 1);
-
- // Update the screen.
- screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
-
- if (screen.ScreenState == ScreenState.TransitionOn ||
- screen.ScreenState == ScreenState.Active)
- {
- // If this is the first active screen we came across,
- // give it a chance to handle input.
- if (!otherScreenHasFocus)
- {
- screen.HandleInput(input);
-
- otherScreenHasFocus = true;
- }
-
- // If this is an active non-popup, inform any subsequent
- // screens that they are covered by it.
- if (!screen.IsPopup)
- coveredByOtherScreen = true;
- }
- }
-
- // Print debug trace?
- if (traceEnabled)
- TraceScreens();
- }
-
-
- ///
- /// Prints a list of all the screens, for debugging.
- ///
- void TraceScreens()
- {
- List screenNames = new List();
-
- foreach (GameScreen screen in screens)
- screenNames.Add(screen.GetType().Name);
-
- Debug.WriteLine(string.Join(", ", screenNames.ToArray()));
- }
-
-
- ///
- /// Tells each screen to draw itself.
- ///
- public override void Draw(GameTime gameTime)
- {
- foreach (GameScreen screen in screens)
- {
- if (screen.ScreenState == ScreenState.Hidden)
- continue;
-
- screen.Draw(gameTime);
- }
- }
-
-
- #endregion
-
- #region Public Methods
-
-
- ///
- /// Adds a new screen to the screen manager.
- ///
- public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
- {
- screen.ControllingPlayer = controllingPlayer;
- screen.ScreenManager = this;
- screen.IsExiting = false;
-
- // If we have a graphics device, tell the screen to load content.
- if (isInitialized)
- {
- screen.LoadContent();
- }
-
- screens.Add(screen);
-
- // update the TouchPanel to respond to gestures this screen is interested in
- TouchPanel.EnabledGestures = screen.EnabledGestures;
- }
-
-
- ///
- /// Removes a screen from the screen manager. You should normally
- /// use GameScreen.ExitScreen instead of calling this directly, so
- /// the screen can gradually transition off rather than just being
- /// instantly removed.
- ///
- public void RemoveScreen(GameScreen screen)
- {
- // If we have a graphics device, tell the screen to unload content.
- if (isInitialized)
- {
- screen.UnloadContent();
- }
-
- screens.Remove(screen);
- screensToUpdate.Remove(screen);
-
- // if there is a screen still in the manager, update TouchPanel
- // to respond to gestures that screen is interested in.
- if (screens.Count > 0)
- {
- TouchPanel.EnabledGestures = screens[screens.Count - 1].EnabledGestures;
- }
- }
-
-
- ///
- /// Expose an array holding all the screens. We return a copy rather
- /// than the real master list, because screens should only ever be added
- /// or removed using the AddScreen and RemoveScreen methods.
- ///
- public GameScreen[] GetScreens()
- {
- return screens.ToArray();
- }
-
-
- ///
- /// Helper draws a translucent black fullscreen sprite, used for fading
- /// screens in and out, and for darkening the background behind popups.
- ///
- public void FadeBackBufferToBlack(float alpha)
- {
- Viewport viewport = GraphicsDevice.Viewport;
-
- spriteBatch.Begin();
-
- spriteBatch.Draw(blankTexture,
- new Rectangle(0, 0, viewport.Width, viewport.Height),
- Color.Black * alpha);
-
- spriteBatch.End();
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/BackgroundScreen.cs b/GameStateManagement/Screens/BackgroundScreen.cs
deleted file mode 100755
index 34574324..00000000
--- a/GameStateManagement/Screens/BackgroundScreen.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// BackgroundScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// The background screen sits behind all the other menu screens.
- /// It draws a background image that remains fixed in place regardless
- /// of whatever transitions the screens on top of it may be doing.
- ///
- class BackgroundScreen : GameScreen
- {
- #region Fields
-
- ContentManager content;
- Texture2D backgroundTexture;
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructor.
- ///
- public BackgroundScreen()
- {
- TransitionOnTime = TimeSpan.FromSeconds(0.5);
- TransitionOffTime = TimeSpan.FromSeconds(0.5);
- }
-
-
- ///
- /// Loads graphics content for this screen. The background texture is quite
- /// big, so we use our own local ContentManager to load it. This allows us
- /// to unload before going from the menus into the game itself, wheras if we
- /// used the shared ContentManager provided by the Game class, the content
- /// would remain loaded forever.
- ///
- public override void LoadContent()
- {
- if (content == null)
- content = new ContentManager(ScreenManager.Game.Services, "Content");
-
- backgroundTexture = content.Load("background");
- }
-
-
- ///
- /// Unloads graphics content for this screen.
- ///
- public override void UnloadContent()
- {
- content.Unload();
- }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Updates the background screen. Unlike most screens, this should not
- /// transition off even if it has been covered by another screen: it is
- /// supposed to be covered, after all! This overload forces the
- /// coveredByOtherScreen parameter to false in order to stop the base
- /// Update method wanting to transition off.
- ///
- public override void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- base.Update(gameTime, otherScreenHasFocus, false);
- }
-
-
- ///
- /// Draws the background screen.
- ///
- public override void Draw(GameTime gameTime)
- {
- SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
- Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
- Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);
-
- spriteBatch.Begin();
-
- spriteBatch.Draw(backgroundTexture, fullscreen,
- new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));
-
- spriteBatch.End();
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/GameplayScreen.cs b/GameStateManagement/Screens/GameplayScreen.cs
deleted file mode 100755
index 7fd4b7dc..00000000
--- a/GameStateManagement/Screens/GameplayScreen.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// GameplayScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using System.Threading;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// This screen implements the actual game logic. It is just a
- /// placeholder to get the idea across: you'll probably want to
- /// put some more interesting gameplay in here!
- ///
- class GameplayScreen : GameScreen
- {
- #region Fields
-
- ContentManager content;
- SpriteFont gameFont;
-
- Vector2 playerPosition = new Vector2(100, 100);
- Vector2 enemyPosition = new Vector2(100, 100);
-
- Random random = new Random();
-
- float pauseAlpha;
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructor.
- ///
- public GameplayScreen()
- {
- TransitionOnTime = TimeSpan.FromSeconds(1.5);
- TransitionOffTime = TimeSpan.FromSeconds(0.5);
- }
-
-
- ///
- /// Load graphics content for the game.
- ///
- public override void LoadContent()
- {
- if (content == null)
- content = new ContentManager(ScreenManager.Game.Services, "Content");
-
- gameFont = content.Load("gamefont");
-
- // A real game would probably have more content than this sample, so
- // it would take longer to load. We simulate that by delaying for a
- // while, giving you a chance to admire the beautiful loading screen.
- Thread.Sleep(1000);
-
- // once the load has finished, we use ResetElapsedTime to tell the game's
- // timing mechanism that we have just finished a very long frame, and that
- // it should not try to catch up.
- ScreenManager.Game.ResetElapsedTime();
- }
-
-
- ///
- /// Unload graphics content used by the game.
- ///
- public override void UnloadContent()
- {
- content.Unload();
- }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Updates the state of the game. This method checks the GameScreen.IsActive
- /// property, so the game will stop updating when the pause menu is active,
- /// or if you tab away to a different application.
- ///
- public override void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- base.Update(gameTime, otherScreenHasFocus, false);
-
- // Gradually fade in or out depending on whether we are covered by the pause screen.
- if (coveredByOtherScreen)
- pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
- else
- pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);
-
- if (IsActive)
- {
- // Apply some random jitter to make the enemy move around.
- const float randomization = 10;
-
- enemyPosition.X += (float)(random.NextDouble() - 0.5) * randomization;
- enemyPosition.Y += (float)(random.NextDouble() - 0.5) * randomization;
-
- // Apply a stabilizing force to stop the enemy moving off the screen.
- Vector2 targetPosition = new Vector2(
- ScreenManager.GraphicsDevice.Viewport.Width / 2 - gameFont.MeasureString("Insert Gameplay Here").X / 2,
- 200);
-
- enemyPosition = Vector2.Lerp(enemyPosition, targetPosition, 0.05f);
-
- // TODO: this game isn't very fun! You could probably improve
- // it by inserting something more interesting in this space :-)
- }
- }
-
-
- ///
- /// Lets the game respond to player input. Unlike the Update method,
- /// this will only be called when the gameplay screen is active.
- ///
- public override void HandleInput(InputState input)
- {
- if (input == null)
- throw new ArgumentNullException("input");
-
- // Look up inputs for the active player profile.
- int playerIndex = (int)ControllingPlayer.Value;
-
- KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];
- GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];
-
- // The game pauses either if the user presses the pause button, or if
- // they unplug the active gamepad. This requires us to keep track of
- // whether a gamepad was ever plugged in, because we don't want to pause
- // on PC if they are playing with a keyboard and have no gamepad at all!
- bool gamePadDisconnected = !gamePadState.IsConnected &&
- input.GamePadWasConnected[playerIndex];
-
- if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)
- {
- ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
- }
- else
- {
- // Otherwise move the player position.
- Vector2 movement = Vector2.Zero;
-
- if (keyboardState.IsKeyDown(Keys.Left))
- movement.X--;
-
- if (keyboardState.IsKeyDown(Keys.Right))
- movement.X++;
-
- if (keyboardState.IsKeyDown(Keys.Up))
- movement.Y--;
-
- if (keyboardState.IsKeyDown(Keys.Down))
- movement.Y++;
-
- Vector2 thumbstick = gamePadState.ThumbSticks.Left;
-
- movement.X += thumbstick.X;
- movement.Y -= thumbstick.Y;
-
- if (movement.Length() > 1)
- movement.Normalize();
-
- playerPosition += movement * 2;
- }
- }
-
-
- ///
- /// Draws the gameplay screen.
- ///
- public override void Draw(GameTime gameTime)
- {
- // This game has a blue background. Why? Because!
- ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
- Color.CornflowerBlue, 0, 0);
-
- // Our player and enemy are both actually just text strings.
- SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
-
- spriteBatch.Begin();
-
- spriteBatch.DrawString(gameFont, "// TODO", playerPosition, Color.Green);
-
- spriteBatch.DrawString(gameFont, "Insert Gameplay Here",
- enemyPosition, Color.DarkRed);
-
- spriteBatch.End();
-
- // If the game is transitioning on or off, fade it out to black.
- if (TransitionPosition > 0 || pauseAlpha > 0)
- {
- float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);
-
- ScreenManager.FadeBackBufferToBlack(alpha);
- }
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/LoadingScreen.cs b/GameStateManagement/Screens/LoadingScreen.cs
deleted file mode 100755
index b9e4ceab..00000000
--- a/GameStateManagement/Screens/LoadingScreen.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// LoadingScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// The loading screen coordinates transitions between the menu system and the
- /// game itself. Normally one screen will transition off at the same time as
- /// the next screen is transitioning on, but for larger transitions that can
- /// take a longer time to load their data, we want the menu system to be entirely
- /// gone before we start loading the game. This is done as follows:
- ///
- /// - Tell all the existing screens to transition off.
- /// - Activate a loading screen, which will transition on at the same time.
- /// - The loading screen watches the state of the previous screens.
- /// - When it sees they have finished transitioning off, it activates the real
- /// next screen, which may take a long time to load its data. The loading
- /// screen will be the only thing displayed while this load is taking place.
- ///
- class LoadingScreen : GameScreen
- {
- #region Fields
-
- bool loadingIsSlow;
- bool otherScreensAreGone;
-
- GameScreen[] screensToLoad;
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// The constructor is private: loading screens should
- /// be activated via the static Load method instead.
- ///
- private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
- GameScreen[] screensToLoad)
- {
- this.loadingIsSlow = loadingIsSlow;
- this.screensToLoad = screensToLoad;
-
- TransitionOnTime = TimeSpan.FromSeconds(0.5);
- }
-
-
- ///
- /// Activates the loading screen.
- ///
- public static void Load(ScreenManager screenManager, bool loadingIsSlow,
- PlayerIndex? controllingPlayer,
- params GameScreen[] screensToLoad)
- {
- // Tell all the current screens to transition off.
- foreach (GameScreen screen in screenManager.GetScreens())
- screen.ExitScreen();
-
- // Create and activate the loading screen.
- LoadingScreen loadingScreen = new LoadingScreen(screenManager,
- loadingIsSlow,
- screensToLoad);
-
- screenManager.AddScreen(loadingScreen, controllingPlayer);
- }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Updates the loading screen.
- ///
- public override void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
-
- // If all the previous screens have finished transitioning
- // off, it is time to actually perform the load.
- if (otherScreensAreGone)
- {
- ScreenManager.RemoveScreen(this);
-
- foreach (GameScreen screen in screensToLoad)
- {
- if (screen != null)
- {
- ScreenManager.AddScreen(screen, ControllingPlayer);
- }
- }
-
- // Once the load has finished, we use ResetElapsedTime to tell
- // the game timing mechanism that we have just finished a very
- // long frame, and that it should not try to catch up.
- ScreenManager.Game.ResetElapsedTime();
- }
- }
-
-
- ///
- /// Draws the loading screen.
- ///
- public override void Draw(GameTime gameTime)
- {
- // If we are the only active screen, that means all the previous screens
- // must have finished transitioning off. We check for this in the Draw
- // method, rather than in Update, because it isn't enough just for the
- // screens to be gone: in order for the transition to look good we must
- // have actually drawn a frame without them before we perform the load.
- if ((ScreenState == ScreenState.Active) &&
- (ScreenManager.GetScreens().Length == 1))
- {
- otherScreensAreGone = true;
- }
-
- // The gameplay screen takes a while to load, so we display a loading
- // message while that is going on, but the menus load very quickly, and
- // it would look silly if we flashed this up for just a fraction of a
- // second while returning from the game to the menus. This parameter
- // tells us how long the loading is going to take, so we know whether
- // to bother drawing the message.
- if (loadingIsSlow)
- {
- SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
- SpriteFont font = ScreenManager.Font;
-
- const string message = "Loading...";
-
- // Center the text in the viewport.
- Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
- Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
- Vector2 textSize = font.MeasureString(message);
- Vector2 textPosition = (viewportSize - textSize) / 2;
-
- Color color = Color.White * TransitionAlpha;
-
- // Draw the text.
- spriteBatch.Begin();
- spriteBatch.DrawString(font, message, textPosition, color);
- spriteBatch.End();
- }
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/MainMenuScreen.cs b/GameStateManagement/Screens/MainMenuScreen.cs
deleted file mode 100755
index 7a60d8e9..00000000
--- a/GameStateManagement/Screens/MainMenuScreen.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// MainMenuScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using Microsoft.Xna.Framework;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// The main menu screen is the first thing displayed when the game starts up.
- ///
- class MainMenuScreen : MenuScreen
- {
- #region Initialization
-
-
- ///
- /// Constructor fills in the menu contents.
- ///
- public MainMenuScreen()
- : base("Main Menu")
- {
- // Create our menu entries.
- MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
- MenuEntry optionsMenuEntry = new MenuEntry("Options");
- MenuEntry exitMenuEntry = new MenuEntry("Exit");
-
- // Hook up menu event handlers.
- playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
- optionsMenuEntry.Selected += OptionsMenuEntrySelected;
- exitMenuEntry.Selected += OnCancel;
-
- // Add entries to the menu.
- MenuEntries.Add(playGameMenuEntry);
- MenuEntries.Add(optionsMenuEntry);
- MenuEntries.Add(exitMenuEntry);
- }
-
-
- #endregion
-
- #region Handle Input
-
-
- ///
- /// Event handler for when the Play Game menu entry is selected.
- ///
- void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
- new GameplayScreen());
- }
-
-
- ///
- /// Event handler for when the Options menu entry is selected.
- ///
- void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex);
- }
-
-
- ///
- /// When the user cancels the main menu, ask if they want to exit the sample.
- ///
- protected override void OnCancel(PlayerIndex playerIndex)
- {
- const string message = "Are you sure you want to exit this sample?";
-
- MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);
-
- confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
-
- ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
- }
-
-
- ///
- /// Event handler for when the user selects ok on the "are you sure
- /// you want to exit" message box.
- ///
- void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
- {
- ScreenManager.Game.Exit();
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/MenuEntry.cs b/GameStateManagement/Screens/MenuEntry.cs
deleted file mode 100755
index c4fb9112..00000000
--- a/GameStateManagement/Screens/MenuEntry.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// MenuEntry.cs
-//
-// XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// Helper class represents a single entry in a MenuScreen. By default this
- /// just draws the entry text string, but it can be customized to display menu
- /// entries in different ways. This also provides an event that will be raised
- /// when the menu entry is selected.
- ///
- class MenuEntry
- {
- #region Fields
-
- ///
- /// The text rendered for this entry.
- ///
- string text;
-
- ///
- /// Tracks a fading selection effect on the entry.
- ///
- ///
- /// The entries transition out of the selection effect when they are deselected.
- ///
- float selectionFade;
-
- ///
- /// The position at which the entry is drawn. This is set by the MenuScreen
- /// each frame in Update.
- ///
- Vector2 position;
-
- #endregion
-
- #region Properties
-
-
- ///
- /// Gets or sets the text of this menu entry.
- ///
- public string Text
- {
- get { return text; }
- set { text = value; }
- }
-
-
- ///
- /// Gets or sets the position at which to draw this menu entry.
- ///
- public Vector2 Position
- {
- get { return position; }
- set { position = value; }
- }
-
-
- #endregion
-
- #region Events
-
-
- ///
- /// Event raised when the menu entry is selected.
- ///
- public event EventHandler Selected;
-
-
- ///
- /// Method for raising the Selected event.
- ///
- protected internal virtual void OnSelectEntry(PlayerIndex playerIndex)
- {
- if (Selected != null)
- Selected(this, new PlayerIndexEventArgs(playerIndex));
- }
-
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructs a new menu entry with the specified text.
- ///
- public MenuEntry(string text)
- {
- this.text = text;
- }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Updates the menu entry.
- ///
- public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
- {
- // there is no such thing as a selected item on Windows Phone, so we always
- // force isSelected to be false
-#if WINDOWS_PHONE
- isSelected = false;
-#endif
-
- // When the menu selection changes, entries gradually fade between
- // their selected and deselected appearance, rather than instantly
- // popping to the new state.
- float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;
-
- if (isSelected)
- selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
- else
- selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
- }
-
-
- ///
- /// Draws the menu entry. This can be overridden to customize the appearance.
- ///
- public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
- {
- // there is no such thing as a selected item on Windows Phone, so we always
- // force isSelected to be false
-#if WINDOWS_PHONE
- isSelected = false;
-#endif
-
- // Draw the selected entry in yellow, otherwise white.
- Color color = isSelected ? Color.Yellow : Color.White;
-
- // Pulsate the size of the selected menu entry.
- double time = gameTime.TotalGameTime.TotalSeconds;
-
- float pulsate = (float)Math.Sin(time * 6) + 1;
-
- float scale = 1 + pulsate * 0.05f * selectionFade;
-
- // Modify the alpha to fade text out during transitions.
- color *= screen.TransitionAlpha;
-
- // Draw text, centered on the middle of each line.
- ScreenManager screenManager = screen.ScreenManager;
- SpriteBatch spriteBatch = screenManager.SpriteBatch;
- SpriteFont font = screenManager.Font;
-
- Vector2 origin = new Vector2(0, font.LineSpacing / 2);
-
- spriteBatch.DrawString(font, text, position, color, 0,
- origin, scale, SpriteEffects.None, 0);
- }
-
-
- ///
- /// Queries how much space this menu entry requires.
- ///
- public virtual int GetHeight(MenuScreen screen)
- {
- return screen.ScreenManager.Font.LineSpacing;
- }
-
-
- ///
- /// Queries how wide the entry is, used for centering on the screen.
- ///
- public virtual int GetWidth(MenuScreen screen)
- {
- return (int)screen.ScreenManager.Font.MeasureString(Text).X;
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/MenuScreen.cs b/GameStateManagement/Screens/MenuScreen.cs
deleted file mode 100755
index d1df27c2..00000000
--- a/GameStateManagement/Screens/MenuScreen.cs
+++ /dev/null
@@ -1,244 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// MenuScreen.cs
-//
-// XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using System.Collections.Generic;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input.Touch;
-using Microsoft.Xna.Framework.Input;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// Base class for screens that contain a menu of options. The user can
- /// move up and down to select an entry, or cancel to back out of the screen.
- ///
- abstract class MenuScreen : GameScreen
- {
- #region Fields
-
- List menuEntries = new List();
- int selectedEntry = 0;
- string menuTitle;
-
- #endregion
-
- #region Properties
-
-
- ///
- /// Gets the list of menu entries, so derived classes can add
- /// or change the menu contents.
- ///
- protected IList MenuEntries
- {
- get { return menuEntries; }
- }
-
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructor.
- ///
- public MenuScreen(string menuTitle)
- {
- this.menuTitle = menuTitle;
-
- TransitionOnTime = TimeSpan.FromSeconds(0.5);
- TransitionOffTime = TimeSpan.FromSeconds(0.5);
- }
-
-
- #endregion
-
- #region Handle Input
-
-
- ///
- /// Responds to user input, changing the selected entry and accepting
- /// or cancelling the menu.
- ///
- public override void HandleInput(InputState input)
- {
- // Move to the previous menu entry?
- if (input.IsMenuUp(ControllingPlayer))
- {
- selectedEntry--;
-
- if (selectedEntry < 0)
- selectedEntry = menuEntries.Count - 1;
- }
-
- // Move to the next menu entry?
- if (input.IsMenuDown(ControllingPlayer))
- {
- selectedEntry++;
-
- if (selectedEntry >= menuEntries.Count)
- selectedEntry = 0;
- }
-
- // Accept or cancel the menu? We pass in our ControllingPlayer, which may
- // either be null (to accept input from any player) or a specific index.
- // If we pass a null controlling player, the InputState helper returns to
- // us which player actually provided the input. We pass that through to
- // OnSelectEntry and OnCancel, so they can tell which player triggered them.
- PlayerIndex playerIndex;
-
- if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
- {
- OnSelectEntry(selectedEntry, playerIndex);
- }
- else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
- {
- OnCancel(playerIndex);
- }
- }
-
-
- ///
- /// Handler for when the user has chosen a menu entry.
- ///
- protected virtual void OnSelectEntry(int entryIndex, PlayerIndex playerIndex)
- {
- menuEntries[entryIndex].OnSelectEntry(playerIndex);
- }
-
-
- ///
- /// Handler for when the user has cancelled the menu.
- ///
- protected virtual void OnCancel(PlayerIndex playerIndex)
- {
- ExitScreen();
- }
-
-
- ///
- /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler.
- ///
- protected void OnCancel(object sender, PlayerIndexEventArgs e)
- {
- OnCancel(e.PlayerIndex);
- }
-
-
- #endregion
-
- #region Update and Draw
-
-
- ///
- /// Allows the screen the chance to position the menu entries. By default
- /// all menu entries are lined up in a vertical list, centered on the screen.
- ///
- protected virtual void UpdateMenuEntryLocations()
- {
- // Make the menu slide into place during transitions, using a
- // power curve to make things look more interesting (this makes
- // the movement slow down as it nears the end).
- float transitionOffset = (float)Math.Pow(TransitionPosition, 2);
-
- // start at Y = 175; each X value is generated per entry
- Vector2 position = new Vector2(0f, 175f);
-
- // update each menu entry's location in turn
- for (int i = 0; i < menuEntries.Count; i++)
- {
- MenuEntry menuEntry = menuEntries[i];
-
- // each entry is to be centered horizontally
- position.X = ScreenManager.GraphicsDevice.Viewport.Width / 2 - menuEntry.GetWidth(this) / 2;
-
- if (ScreenState == ScreenState.TransitionOn)
- position.X -= transitionOffset * 256;
- else
- position.X += transitionOffset * 512;
-
- // set the entry's position
- menuEntry.Position = position;
-
- // move down for the next entry the size of this entry
- position.Y += menuEntry.GetHeight(this);
- }
- }
-
-
- ///
- /// Updates the menu.
- ///
- public override void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
-
- // Update each nested MenuEntry object.
- for (int i = 0; i < menuEntries.Count; i++)
- {
- bool isSelected = IsActive && (i == selectedEntry);
-
- menuEntries[i].Update(this, isSelected, gameTime);
- }
- }
-
-
- ///
- /// Draws the menu.
- ///
- public override void Draw(GameTime gameTime)
- {
- // make sure our entries are in the right place before we draw them
- UpdateMenuEntryLocations();
-
- GraphicsDevice graphics = ScreenManager.GraphicsDevice;
- SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
- SpriteFont font = ScreenManager.Font;
-
- spriteBatch.Begin();
-
- // Draw each menu entry in turn.
- for (int i = 0; i < menuEntries.Count; i++)
- {
- MenuEntry menuEntry = menuEntries[i];
-
- bool isSelected = IsActive && (i == selectedEntry);
-
- menuEntry.Draw(this, isSelected, gameTime);
- }
-
- // Make the menu slide into place during transitions, using a
- // power curve to make things look more interesting (this makes
- // the movement slow down as it nears the end).
- float transitionOffset = (float)Math.Pow(TransitionPosition, 2);
-
- // Draw the menu title centered on the screen
- Vector2 titlePosition = new Vector2(graphics.Viewport.Width / 2, 80);
- Vector2 titleOrigin = font.MeasureString(menuTitle) / 2;
- Color titleColor = new Color(192, 192, 192) * TransitionAlpha;
- float titleScale = 1.25f;
-
- titlePosition.Y -= transitionOffset * 100;
-
- spriteBatch.DrawString(font, menuTitle, titlePosition, titleColor, 0,
- titleOrigin, titleScale, SpriteEffects.None, 0);
-
- spriteBatch.End();
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/MessageBoxScreen.cs b/GameStateManagement/Screens/MessageBoxScreen.cs
deleted file mode 100755
index c9644b17..00000000
--- a/GameStateManagement/Screens/MessageBoxScreen.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// MessageBoxScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// A popup message box screen, used to display "are you sure?"
- /// confirmation messages.
- ///
- class MessageBoxScreen : GameScreen
- {
- #region Fields
-
- string message;
- Texture2D gradientTexture;
-
- #endregion
-
- #region Events
-
- public event EventHandler Accepted;
- public event EventHandler Cancelled;
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructor automatically includes the standard "A=ok, B=cancel"
- /// usage text prompt.
- ///
- public MessageBoxScreen(string message)
- : this(message, true)
- { }
-
-
- ///
- /// Constructor lets the caller specify whether to include the standard
- /// "A=ok, B=cancel" usage text prompt.
- ///
- public MessageBoxScreen(string message, bool includeUsageText)
- {
- const string usageText = "\nA button, Space, Enter = ok" +
- "\nB button, Esc = cancel";
-
- if (includeUsageText)
- this.message = message + usageText;
- else
- this.message = message;
-
- IsPopup = true;
-
- TransitionOnTime = TimeSpan.FromSeconds(0.2);
- TransitionOffTime = TimeSpan.FromSeconds(0.2);
- }
-
-
- ///
- /// Loads graphics content for this screen. This uses the shared ContentManager
- /// provided by the Game class, so the content will remain loaded forever.
- /// Whenever a subsequent MessageBoxScreen tries to load this same content,
- /// it will just get back another reference to the already loaded data.
- ///
- public override void LoadContent()
- {
- ContentManager content = ScreenManager.Game.Content;
-
- gradientTexture = content.Load("gradient");
- }
-
-
- #endregion
-
- #region Handle Input
-
-
- ///
- /// Responds to user input, accepting or cancelling the message box.
- ///
- public override void HandleInput(InputState input)
- {
- PlayerIndex playerIndex;
-
- // We pass in our ControllingPlayer, which may either be null (to
- // accept input from any player) or a specific index. If we pass a null
- // controlling player, the InputState helper returns to us which player
- // actually provided the input. We pass that through to our Accepted and
- // Cancelled events, so they can tell which player triggered them.
- if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
- {
- // Raise the accepted event, then exit the message box.
- if (Accepted != null)
- Accepted(this, new PlayerIndexEventArgs(playerIndex));
-
- ExitScreen();
- }
- else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
- {
- // Raise the cancelled event, then exit the message box.
- if (Cancelled != null)
- Cancelled(this, new PlayerIndexEventArgs(playerIndex));
-
- ExitScreen();
- }
- }
-
-
- #endregion
-
- #region Draw
-
-
- ///
- /// Draws the message box.
- ///
- public override void Draw(GameTime gameTime)
- {
- SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
- SpriteFont font = ScreenManager.Font;
-
- // Darken down any other screens that were drawn beneath the popup.
- ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);
-
- // Center the message text in the viewport.
- Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
- Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
- Vector2 textSize = font.MeasureString(message);
- Vector2 textPosition = (viewportSize - textSize) / 2;
-
- // The background includes a border somewhat larger than the text itself.
- const int hPad = 32;
- const int vPad = 16;
-
- Rectangle backgroundRectangle = new Rectangle((int)textPosition.X - hPad,
- (int)textPosition.Y - vPad,
- (int)textSize.X + hPad * 2,
- (int)textSize.Y + vPad * 2);
-
- // Fade the popup alpha during transitions.
- Color color = Color.White * TransitionAlpha;
-
- spriteBatch.Begin();
-
- // Draw the background rectangle.
- spriteBatch.Draw(gradientTexture, backgroundRectangle, color);
-
- // Draw the message box text.
- spriteBatch.DrawString(font, message, textPosition, color);
-
- spriteBatch.End();
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/OptionsMenuScreen.cs b/GameStateManagement/Screens/OptionsMenuScreen.cs
deleted file mode 100755
index 8e549dbc..00000000
--- a/GameStateManagement/Screens/OptionsMenuScreen.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// OptionsMenuScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using Microsoft.Xna.Framework;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// The options screen is brought up over the top of the main menu
- /// screen, and gives the user a chance to configure the game
- /// in various hopefully useful ways.
- ///
- class OptionsMenuScreen : MenuScreen
- {
- #region Fields
-
- MenuEntry ungulateMenuEntry;
- MenuEntry languageMenuEntry;
- MenuEntry frobnicateMenuEntry;
- MenuEntry elfMenuEntry;
-
- enum Ungulate
- {
- BactrianCamel,
- Dromedary,
- Llama,
- }
-
- static Ungulate currentUngulate = Ungulate.Dromedary;
-
- static string[] languages = { "C#", "French", "Deoxyribonucleic acid" };
- static int currentLanguage = 0;
-
- static bool frobnicate = true;
-
- static int elf = 23;
-
- #endregion
-
- #region Initialization
-
-
- ///
- /// Constructor.
- ///
- public OptionsMenuScreen()
- : base("Options")
- {
- // Create our menu entries.
- ungulateMenuEntry = new MenuEntry(string.Empty);
- languageMenuEntry = new MenuEntry(string.Empty);
- frobnicateMenuEntry = new MenuEntry(string.Empty);
- elfMenuEntry = new MenuEntry(string.Empty);
-
- SetMenuEntryText();
-
- MenuEntry back = new MenuEntry("Back");
-
- // Hook up menu event handlers.
- ungulateMenuEntry.Selected += UngulateMenuEntrySelected;
- languageMenuEntry.Selected += LanguageMenuEntrySelected;
- frobnicateMenuEntry.Selected += FrobnicateMenuEntrySelected;
- elfMenuEntry.Selected += ElfMenuEntrySelected;
- back.Selected += OnCancel;
-
- // Add entries to the menu.
- MenuEntries.Add(ungulateMenuEntry);
- MenuEntries.Add(languageMenuEntry);
- MenuEntries.Add(frobnicateMenuEntry);
- MenuEntries.Add(elfMenuEntry);
- MenuEntries.Add(back);
- }
-
-
- ///
- /// Fills in the latest values for the options screen menu text.
- ///
- void SetMenuEntryText()
- {
- ungulateMenuEntry.Text = "Preferred ungulate: " + currentUngulate;
- languageMenuEntry.Text = "Language: " + languages[currentLanguage];
- frobnicateMenuEntry.Text = "Frobnicate: " + (frobnicate ? "on" : "off");
- elfMenuEntry.Text = "elf: " + elf;
- }
-
-
- #endregion
-
- #region Handle Input
-
-
- ///
- /// Event handler for when the Ungulate menu entry is selected.
- ///
- void UngulateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- currentUngulate++;
-
- if (currentUngulate > Ungulate.Llama)
- currentUngulate = 0;
-
- SetMenuEntryText();
- }
-
-
- ///
- /// Event handler for when the Language menu entry is selected.
- ///
- void LanguageMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- currentLanguage = (currentLanguage + 1) % languages.Length;
-
- SetMenuEntryText();
- }
-
-
- ///
- /// Event handler for when the Frobnicate menu entry is selected.
- ///
- void FrobnicateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- frobnicate = !frobnicate;
-
- SetMenuEntryText();
- }
-
-
- ///
- /// Event handler for when the Elf menu entry is selected.
- ///
- void ElfMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- elf++;
-
- SetMenuEntryText();
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/PauseMenuScreen.cs b/GameStateManagement/Screens/PauseMenuScreen.cs
deleted file mode 100755
index 667ff71a..00000000
--- a/GameStateManagement/Screens/PauseMenuScreen.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// PauseMenuScreen.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using Microsoft.Xna.Framework;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// The pause menu comes up over the top of the game,
- /// giving the player options to resume or quit.
- ///
- class PauseMenuScreen : MenuScreen
- {
- #region Initialization
-
-
- ///
- /// Constructor.
- ///
- public PauseMenuScreen()
- : base("Paused")
- {
- // Create our menu entries.
- MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
- MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
-
- // Hook up menu event handlers.
- resumeGameMenuEntry.Selected += OnCancel;
- quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
-
- // Add entries to the menu.
- MenuEntries.Add(resumeGameMenuEntry);
- MenuEntries.Add(quitGameMenuEntry);
- }
-
-
- #endregion
-
- #region Handle Input
-
-
- ///
- /// Event handler for when the Quit Game menu entry is selected.
- ///
- void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
- {
- const string message = "Are you sure you want to quit this game?";
-
- MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);
-
- confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
-
- ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
- }
-
-
- ///
- /// Event handler for when the user selects ok on the "are you sure
- /// you want to quit" message box. This uses the loading screen to
- /// transition from the game back to the main menu screen.
- ///
- void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
- {
- LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
- new MainMenuScreen());
- }
-
-
- #endregion
- }
-}
diff --git a/GameStateManagement/Screens/PlayerIndexEventArgs.cs b/GameStateManagement/Screens/PlayerIndexEventArgs.cs
deleted file mode 100755
index d9f38fcc..00000000
--- a/GameStateManagement/Screens/PlayerIndexEventArgs.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// PlayerIndexEventArgs.cs
-//
-// XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using Microsoft.Xna.Framework;
-#endregion
-
-namespace GameStateManagement
-{
- ///
- /// Custom event argument which includes the index of the player who
- /// triggered the event. This is used by the MenuEntry.Selected event.
- ///
- class PlayerIndexEventArgs : EventArgs
- {
- ///
- /// Constructor.
- ///
- public PlayerIndexEventArgs(PlayerIndex playerIndex)
- {
- this.playerIndex = playerIndex;
- }
-
-
- ///
- /// Gets the index of the player who triggered this event.
- ///
- public PlayerIndex PlayerIndex
- {
- get { return playerIndex; }
- }
-
- PlayerIndex playerIndex;
- }
-}
diff --git a/GooCursor/GooCursor.MacOS.csproj b/GooCursor/GooCursor.MacOS.csproj
index e79ac4f8..9073794d 100644
--- a/GooCursor/GooCursor.MacOS.csproj
+++ b/GooCursor/GooCursor.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
x86
10.0.0
2.0
{18E6467D-47C4-47CA-8CD1-508AD311C054}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
GooCursor
GooCursor
True
+ v2.0
+ Xamarin.Mac
True
diff --git a/GooCursor/Program.cs b/GooCursor/Program.cs
index 63ab3dbd..f7c1133a 100644
--- a/GooCursor/Program.cs
+++ b/GooCursor/Program.cs
@@ -5,17 +5,17 @@
using System.Linq;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endif
#endregion
namespace GooCursor
{
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -35,7 +35,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/Graphics3DSample/Graphics3DSample.MacOS.csproj b/Graphics3DSample/Graphics3DSample.MacOS.csproj
index 248d94f2..a5498660 100644
--- a/Graphics3DSample/Graphics3DSample.MacOS.csproj
+++ b/Graphics3DSample/Graphics3DSample.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{C3D02EFA-1C48-415C-8811-56D20434FD68}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
Graphics3DSample
Graphics3DSample
+ True
+ v2.0
+ Xamarin.Mac
True
diff --git a/Graphics3DSample/Main.cs b/Graphics3DSample/Main.cs
index 466c93f7..50f1cef4 100644
--- a/Graphics3DSample/Main.cs
+++ b/Graphics3DSample/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace Graphics3DSample
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
Graphics3DSampleGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Graphics3DSampleGame ();
game.Run ();
diff --git a/HoneycombRush/HoneycombRush.MacOS.csproj b/HoneycombRush/HoneycombRush.MacOS.csproj
index 3d74a7ac..7d4ab44c 100644
--- a/HoneycombRush/HoneycombRush.MacOS.csproj
+++ b/HoneycombRush/HoneycombRush.MacOS.csproj
@@ -1,16 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{2C0696B3-0D1E-4039-B4AB-9A210B3CF290}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
HoneycombRush
HoneycombRush
True
+ v2.0
+ Xamarin.Mac
True
diff --git a/HoneycombRush/HoneycombRush.cs b/HoneycombRush/HoneycombRush.cs
index b9d4cfca..2ac1a833 100644
--- a/HoneycombRush/HoneycombRush.cs
+++ b/HoneycombRush/HoneycombRush.cs
@@ -56,7 +56,7 @@ public HoneycombRush()
graphics.IsFullScreen = true;
screenManager = new ScreenManager(this, Vector2.One);
-#elif WINDOWS || MONOMAC || LINUX
+#elif WINDOWS || __MACOS__ || LINUX
graphics.PreferredBackBufferHeight = 480;
graphics.PreferredBackBufferWidth = 800;
diff --git a/HoneycombRush/Program.cs b/HoneycombRush/Program.cs
index b2efe333..61829074 100644
--- a/HoneycombRush/Program.cs
+++ b/HoneycombRush/Program.cs
@@ -29,7 +29,7 @@ static void Main(string[] args)
}
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -37,25 +37,25 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
HoneycombRush game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new HoneycombRush();
game.Run();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/HoneycombRush/Screens/GameplayScreen.cs b/HoneycombRush/Screens/GameplayScreen.cs
index cce021d2..b6ae2ced 100644
--- a/HoneycombRush/Screens/GameplayScreen.cs
+++ b/HoneycombRush/Screens/GameplayScreen.cs
@@ -20,8 +20,8 @@
using Microsoft.Xna.Framework.Input.Touch;
using System.Xml.Linq;
-#if MONOMAC
-using MonoMac.Foundation;
+#if __MACOS__
+using Foundation;
#endif
using System.IO;
diff --git a/HoneycombRush/Screens/LevelOverScreen.cs b/HoneycombRush/Screens/LevelOverScreen.cs
index 90951991..b0f00e6a 100644
--- a/HoneycombRush/Screens/LevelOverScreen.cs
+++ b/HoneycombRush/Screens/LevelOverScreen.cs
@@ -252,12 +252,12 @@ private void StartNewLevelOrExit(InputState input)
// If not already loading
else if (!isLoading)
{
-#if MONOMAC
+#if __MACOS__
// Start loading the resources on main thread
// If not then all sorts of errors happen for
// AutoReleasPools and OpenGL does not handle
// multiple thread to well when using Thread
- MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread(delegate {
+ AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread(delegate {
gameplayScreen.LoadAssets ();
isLoading = false;
assetsLoaded = true;
diff --git a/HoneycombRush/Screens/LoadingAndInstructionScreen.cs b/HoneycombRush/Screens/LoadingAndInstructionScreen.cs
index 4daeb78f..f799195e 100644
--- a/HoneycombRush/Screens/LoadingAndInstructionScreen.cs
+++ b/HoneycombRush/Screens/LoadingAndInstructionScreen.cs
@@ -190,12 +190,12 @@ public override void Draw(GameTime gameTime)
private void LoadResources()
{
-#if MONOMAC
+#if __MACOS__
// Start loading the resources on main thread
// If not then all sorts of errors happen for
// AutoReleasPools and OpenGL does not handle
// multiple thread to well when using Thread
- MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread(delegate {
+ AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread(delegate {
gameplayScreen.LoadAssets ();
isLoading = false;
assetsLoaded = true;
diff --git a/InputReporter/InputReporter.MacOS.csproj b/InputReporter/InputReporter.MacOS.csproj
index b49fdae5..29866d92 100644
--- a/InputReporter/InputReporter.MacOS.csproj
+++ b/InputReporter/InputReporter.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{A0669F3D-AB7C-43BB-9423-506E24629EF0}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
InputReporter
InputReporter
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -45,7 +49,10 @@
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
diff --git a/InputReporter/Program.cs b/InputReporter/Program.cs
index 7a26ae47..baac91ae 100644
--- a/InputReporter/Program.cs
+++ b/InputReporter/Program.cs
@@ -8,25 +8,25 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
InputReporterGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new InputReporterGame();
game.Run ();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/LensFlare/LensFlare.MacOS.csproj b/LensFlare/LensFlare.MacOS.csproj
index 9b58e993..75b6d751 100644
--- a/LensFlare/LensFlare.MacOS.csproj
+++ b/LensFlare/LensFlare.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{3CBC795F-4472-4669-8A0F-9710F5D5CA56}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
LensFlare
LensFlare
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -64,7 +68,10 @@
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
diff --git a/LensFlare/Main.cs b/LensFlare/Main.cs
index 19a9fc0c..0246ffdd 100644
--- a/LensFlare/Main.cs
+++ b/LensFlare/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace LensFlare
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
LensFlareGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new LensFlareGame ();
game.Run ();
diff --git a/MonoGame.Samples.MacOS.sln b/MonoGame.Samples.MacOS.sln
index 000e3272..2019820f 100644
--- a/MonoGame.Samples.MacOS.sln
+++ b/MonoGame.Samples.MacOS.sln
@@ -1,10 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Framework.MacOS", "..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj", "{36C538E6-C32A-4A8D-A39C-566173D7118E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network.MacOS", "..\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj", "{AE483C29-042E-4226-BA52-D247CE7676DA}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BouncingBox.MacOS", "BouncingBox\BouncingBox.MacOS.csproj", "{4480BF44-7CE2-4A22-9372-DAFA3B05390E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BookSourceCode", "BookSourceCode", "{80262DC5-B246-4DF4-88CD-D1742CCF81BA}"
@@ -110,7 +106,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Audio3D.MacOS", "Audio3D\Audio3D.MacOS.csproj", "{D5C989FD-6AE3-417F-BCB9-7AE30F195A31}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShadowMapping.MacOS", "ShadowMapping\ShadowMapping.MacOS.csproj", "{36473816-E068-4D38-84F3-F5564BA77FF8}"
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CollisionSample", "CollisionSample\CollisionSample.csproj", "{AFFFC991-4956-45EF-8746-C1AE3FC7A245}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -346,26 +341,6 @@ Global
{36473816-E068-4D38-84F3-F5564BA77FF8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{36473816-E068-4D38-84F3-F5564BA77FF8}.Release|x86.ActiveCfg = Release|Any CPU
{36473816-E068-4D38-84F3-F5564BA77FF8}.Release|x86.Build.0 = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.AppStore|Any CPU.Build.0 = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|iPhone.Build.0 = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Debug|x86.Build.0 = Debug|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.ActiveCfg = Distribution|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Distribution|Any CPU.Build.0 = Distribution|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|Any CPU.Build.0 = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|iPhone.ActiveCfg = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|iPhone.Build.0 = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|x86.ActiveCfg = Release|Any CPU
- {36C538E6-C32A-4A8D-A39C-566173D7118E}.Release|x86.Build.0 = Release|Any CPU
{3B9ABB34-4D0F-4CFD-A02D-30D5569A060B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B9ABB34-4D0F-4CFD-A02D-30D5569A060B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B9ABB34-4D0F-4CFD-A02D-30D5569A060B}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -686,12 +661,6 @@ Global
{A93553D9-11E5-4B0B-9809-4E4765D5FD8F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A93553D9-11E5-4B0B-9809-4E4765D5FD8F}.Release|x86.ActiveCfg = Release|Any CPU
{A93553D9-11E5-4B0B-9809-4E4765D5FD8F}.Release|x86.Build.0 = Release|Any CPU
- {AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AE483C29-042E-4226-BA52-D247CE7676DA}.Distribution|Any CPU.ActiveCfg = Debug|Any CPU
- {AE483C29-042E-4226-BA52-D247CE7676DA}.Distribution|Any CPU.Build.0 = Debug|Any CPU
- {AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Any CPU.Build.0 = Release|Any CPU
{C3D02EFA-1C48-415C-8811-56D20434FD68}.AppStore|Any CPU.ActiveCfg = AppStore|Any CPU
{C3D02EFA-1C48-415C-8811-56D20434FD68}.AppStore|Any CPU.Build.0 = AppStore|Any CPU
{C3D02EFA-1C48-415C-8811-56D20434FD68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -930,15 +899,27 @@ Global
StartupItem = ..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj
Policies = $0
$0.TextStylePolicy = $1
- $1.FileWidth = 120
- $1.TabWidth = 4
$1.EolMarker = Windows
- $1.inheritsSet = Mono
- $1.inheritsScope = text/plain
$1.scope = text/x-csharp
+ $1.IndentWidth = 8
$0.CSharpFormattingPolicy = $2
- $2.inheritsSet = Mono
- $2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
+ $2.IndentSwitchSection = False
+ $2.NewLinesForBracesInProperties = False
+ $2.NewLinesForBracesInAccessors = False
+ $2.NewLinesForBracesInAnonymousMethods = False
+ $2.NewLinesForBracesInControlBlocks = False
+ $2.NewLinesForBracesInAnonymousTypes = False
+ $2.NewLinesForBracesInObjectCollectionArrayInitializers = False
+ $2.NewLinesForBracesInLambdaExpressionBody = False
+ $2.NewLineForElse = False
+ $2.NewLineForCatch = False
+ $2.NewLineForFinally = False
+ $2.NewLineForMembersInObjectInit = False
+ $2.NewLineForMembersInAnonymousTypes = False
+ $2.NewLineForClausesInQuery = False
+ $2.SpacingAfterMethodDeclarationName = True
+ $2.SpaceAfterMethodCallName = True
+ $2.SpaceBeforeOpenSquareBracket = True
EndGlobalSection
EndGlobal
diff --git a/NetRumble/BloomPostprocess/BloomComponent.cs b/NetRumble/BloomPostprocess/BloomComponent.cs
index 0bc6916d..a10701b6 100644
--- a/NetRumble/BloomPostprocess/BloomComponent.cs
+++ b/NetRumble/BloomPostprocess/BloomComponent.cs
@@ -77,7 +77,7 @@ public BloomComponent(Game game)
: base(game)
{
if (game == null)
- throw new ArgumentNullException("game");
+ throw new ArgumentNullException(nameof (game));
content = new ContentManager(game.Services, "Content/BloomPostprocess");
}
diff --git a/NetRumble/Gameplay/Asteroid.cs b/NetRumble/Gameplay/Asteroid.cs
index 499e7be7..55a7ea3b 100644
--- a/NetRumble/Gameplay/Asteroid.cs
+++ b/NetRumble/Gameplay/Asteroid.cs
@@ -233,7 +233,7 @@ public static void LoadContent(ContentManager contentManager)
// safety-check the parameters
if (contentManager == null)
{
- throw new ArgumentNullException("contentManager");
+ throw new ArgumentNullException(nameof (contentManager));
}
// load each asteroid's texture
diff --git a/NetRumble/Gameplay/CollisionManager.cs b/NetRumble/Gameplay/CollisionManager.cs
index 48ed52de..9a1bf060 100644
--- a/NetRumble/Gameplay/CollisionManager.cs
+++ b/NetRumble/Gameplay/CollisionManager.cs
@@ -238,7 +238,7 @@ private static Vector2 MoveAndCollide(GameplayObject gameplayObject,
if (gameplayObject == null)
{
- throw new ArgumentNullException("gameplayObject");
+ throw new ArgumentNullException(nameof (gameplayObject));
}
// make sure we care about where this gameplayObject goes
if (!gameplayObject.Active)
@@ -296,7 +296,7 @@ public static void Collide(GameplayObject gameplayObject, Vector2 movement)
if (gameplayObject == null)
{
- throw new ArgumentNullException("gameplayObject");
+ throw new ArgumentNullException(nameof (gameplayObject));
}
if (!gameplayObject.Active)
{
diff --git a/NetRumble/Info.plist b/NetRumble/Info.plist
index 72b32686..499dee61 100644
--- a/NetRumble/Info.plist
+++ b/NetRumble/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/NetRumble/NetRumble.MacOS.csproj b/NetRumble/NetRumble.MacOS.csproj
index 6380141a..1e4ac6a7 100644
--- a/NetRumble/NetRumble.MacOS.csproj
+++ b/NetRumble/NetRumble.MacOS.csproj
@@ -1,23 +1,26 @@
+
Debug
AnyCPU
10.0.0
2.0
{52735207-2136-433B-A3E4-4C082728EED8}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
NetRumble
NetRumble
True
+ v2.0
+ Xamarin.Mac
True
full
False
bin\Debug
- DEBUG;MONOMAC
+ DEBUG;__MACOS__
prompt
4
False
@@ -26,6 +29,7 @@
False
False
False
+ None
none
@@ -38,16 +42,19 @@
False
False
False
- MONOMAC
+ __MACOS__
False
+ None
-
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -106,9 +113,10 @@
+
-
-
+
+
@@ -237,18 +245,9 @@
PreserveNewest
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
+
diff --git a/NetRumble/NetRumbleGame.cs b/NetRumble/NetRumbleGame.cs
index 3b6c9790..5025f6b0 100644
--- a/NetRumble/NetRumbleGame.cs
+++ b/NetRumble/NetRumbleGame.cs
@@ -73,7 +73,7 @@ public NetRumbleGame()
// initialize the graphics device manager
graphics = new GraphicsDeviceManager(this);
-#if LINUX || MONOMAC || LINUX || WINDOWS
+#if LINUX || __MACOS__ || LINUX || WINDOWS
graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
#else
diff --git a/NetRumble/Program.cs b/NetRumble/Program.cs
index bcf8f156..77fb24ae 100644
--- a/NetRumble/Program.cs
+++ b/NetRumble/Program.cs
@@ -51,12 +51,12 @@ purpose and non-infringement.
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Net;
-
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+using Microsoft.Xna.Framework.Net;
+
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endif
#endregion
@@ -65,7 +65,7 @@ purpose and non-infringement.
namespace NetRumble
{
#region Entry Point
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -85,7 +85,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
NetRumbleGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new NetRumbleGame();
game.Run();
diff --git a/NetRumble/packages.config b/NetRumble/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/NetRumble/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/NetworkPrediction/NetworkPrediction.MacOS.csproj b/NetworkPrediction/NetworkPrediction.MacOS.csproj
index f90a09c4..75746c7c 100644
--- a/NetworkPrediction/NetworkPrediction.MacOS.csproj
+++ b/NetworkPrediction/NetworkPrediction.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{05E3B2AB-1E38-4E19-864D-BECFA95139D6}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
NetworkPrediction
NetworkPrediction
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -45,7 +49,10 @@
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
diff --git a/NetworkPrediction/Program.cs b/NetworkPrediction/Program.cs
index a44e8ad4..aef882fa 100644
--- a/NetworkPrediction/Program.cs
+++ b/NetworkPrediction/Program.cs
@@ -53,9 +53,9 @@ purpose and non-infringement.
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#endregion
@@ -83,7 +83,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
NetworkPredictionGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new NetworkPredictionGame();
game.Run();
diff --git a/NetworkStateManagement/NetworkStateManagement.MacOS.csproj b/NetworkStateManagement/NetworkStateManagement.MacOS.csproj
index 00a22a00..538f6a9c 100644
--- a/NetworkStateManagement/NetworkStateManagement.MacOS.csproj
+++ b/NetworkStateManagement/NetworkStateManagement.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{71871CF8-8563-4FA3-ABF2-EC1CBBF817E4}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
NetworkStateManagement
NetworkStateManagement
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -46,7 +50,10 @@
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
diff --git a/NetworkStateManagement/Program.cs b/NetworkStateManagement/Program.cs
index e464acec..31bbc396 100644
--- a/NetworkStateManagement/Program.cs
+++ b/NetworkStateManagement/Program.cs
@@ -2,15 +2,15 @@
using System.Collections.Generic;
using System.Linq;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
namespace NetworkStateManagement
{
#region Entry Point
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -32,7 +32,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
NetworkStateManagementGame game = new NetworkStateManagementGame ();
game.Run ();
diff --git a/Particle3DSample/Program.cs b/Particle3DSample/Program.cs
index fd923c36..a676a83c 100755
--- a/Particle3DSample/Program.cs
+++ b/Particle3DSample/Program.cs
@@ -1,6 +1,6 @@
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
namespace Particle3DSample
@@ -12,7 +12,7 @@ static class Program
///
static void Main (string[] args)
{
-#if MONOMAC
+#if __MACOS__
NSApplication.Init ();
using (var p = new NSAutoreleasePool ()) {
@@ -27,11 +27,11 @@ static void Main (string[] args)
}
}
-#if MONOMAC
+#if __MACOS__
class AppDelegate : NSApplicationDelegate
{
Particle3DSampleGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Particle3DSampleGame();
game.Run();
diff --git a/ParticleSample/Program.cs b/ParticleSample/Program.cs
index a2292c97..881f188e 100644
--- a/ParticleSample/Program.cs
+++ b/ParticleSample/Program.cs
@@ -31,7 +31,7 @@ static void Main(string[] args)
UIApplication.Main(args, null, "AppDelegate");
}
}
-#elif MONOMAC
+#elif __MACOS__
static class Program
{
///
@@ -39,19 +39,19 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
ParticleSampleGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new ParticleSampleGame();
@@ -59,7 +59,7 @@ public override void FinishedLaunching (MonoMac.Foundation.NSObject notification
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/Peer2PeerSample/Program.cs b/Peer2PeerSample/Program.cs
index 117eb57c..554b046a 100644
--- a/Peer2PeerSample/Program.cs
+++ b/Peer2PeerSample/Program.cs
@@ -15,10 +15,10 @@
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -31,7 +31,7 @@ namespace PeerToPeer
{
#region Entry Point
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -51,7 +51,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
PeerToPeerGame game = new PeerToPeerGame ();
game.Run ();
diff --git a/PerPixelCollisionSample/Program.cs b/PerPixelCollisionSample/Program.cs
index 44b52418..92e421f0 100755
--- a/PerPixelCollisionSample/Program.cs
+++ b/PerPixelCollisionSample/Program.cs
@@ -10,10 +10,10 @@
#region Using Statements
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -22,7 +22,7 @@
namespace PerPixelCollision
{
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -42,7 +42,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
PerPixelCollisionGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new PerPixelCollisionGame();
game.Run ();
diff --git a/PerformanceMeasuring/Main.cs b/PerformanceMeasuring/Main.cs
index 6b0989c6..e0aa5540 100644
--- a/PerformanceMeasuring/Main.cs
+++ b/PerformanceMeasuring/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace PerformanceMeasuring
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
PerformanceMeasuringGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new PerformanceMeasuringGame ();
game.Run ();
diff --git a/Primitives/Program.cs b/Primitives/Program.cs
index 5a8c3014..ddf531cd 100644
--- a/Primitives/Program.cs
+++ b/Primitives/Program.cs
@@ -11,26 +11,26 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate ();
- MonoMac.AppKit.NSApplication.Main (args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate ();
+ AppKit.NSApplication.Main (args);
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
PrimitivesSampleGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new PrimitivesSampleGame();
game.Run();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/ReachGraphicsDemo/DemoGame.cs b/ReachGraphicsDemo/DemoGame.cs
index ec78be30..a4b9760f 100755
--- a/ReachGraphicsDemo/DemoGame.cs
+++ b/ReachGraphicsDemo/DemoGame.cs
@@ -10,15 +10,8 @@
#region Using Statements
using System;
using System.Collections.Generic;
-using System.Linq;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Input.Touch;
-using Microsoft.Xna.Framework.Media;
#endregion
namespace XnaGraphicsDemo
diff --git a/ReachGraphicsDemo/Info.plist b/ReachGraphicsDemo/Info.plist
index 6ee15f5c..c6c12fcd 100644
--- a/ReachGraphicsDemo/Info.plist
+++ b/ReachGraphicsDemo/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/ReachGraphicsDemo/Program.cs b/ReachGraphicsDemo/Program.cs
index b6a18fc2..8af47b39 100755
--- a/ReachGraphicsDemo/Program.cs
+++ b/ReachGraphicsDemo/Program.cs
@@ -7,9 +7,9 @@
//-----------------------------------------------------------------------------
#endregion
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
@@ -17,7 +17,7 @@
namespace XnaGraphicsDemo
{
-#if MONOMAC
+#if __MACOS__
class Program
{
static void Main (string[] args)
@@ -40,7 +40,7 @@ class AppDelegate : NSApplicationDelegate
{
private DemoGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new DemoGame();
game.Run();
diff --git a/ReachGraphicsDemo/ReachGraphicsDemo.MacOS.csproj b/ReachGraphicsDemo/ReachGraphicsDemo.MacOS.csproj
index dd61af12..1789699d 100644
--- a/ReachGraphicsDemo/ReachGraphicsDemo.MacOS.csproj
+++ b/ReachGraphicsDemo/ReachGraphicsDemo.MacOS.csproj
@@ -1,8 +1,9 @@
+
{EF8F598D-9F68-44B1-9DD1-BEF79E088CF9}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Debug
x86
Exe
@@ -18,6 +19,10 @@
GameThumbnail.png
10.0.0
2.0
+ v2.0
+ Resources
+ MacOSX
+ Xamarin.Mac
bin\x86\Debug
@@ -29,7 +34,7 @@
True
full
False
- DEBUG;TRACE;MONOMAC
+ DEBUG;TRACE;__MACOS__
false
False
False
@@ -46,7 +51,7 @@
x86
pdbonly
True
- TRACE;MONOMAC
+ TRACE;__MACOS__
true
False
False
@@ -56,6 +61,7 @@
+
@@ -106,12 +112,14 @@
-
- False
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
-
-
+
+
+
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
+
+
+
\ No newline at end of file
diff --git a/ReachGraphicsDemoDataTypes/packages.config b/ReachGraphicsDemoDataTypes/packages.config
new file mode 100644
index 00000000..1e2bdd8a
--- /dev/null
+++ b/ReachGraphicsDemoDataTypes/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/RectangleCollisionSample/Program.cs b/RectangleCollisionSample/Program.cs
index 55659af1..96bfa1d8 100755
--- a/RectangleCollisionSample/Program.cs
+++ b/RectangleCollisionSample/Program.cs
@@ -10,10 +10,10 @@
#region Using Statements
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -23,7 +23,7 @@
namespace RectangleCollision
{
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -43,7 +43,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
RectangleCollisionGame game = new RectangleCollisionGame ();
game.Run ();
diff --git a/RenderTarget2DSample/Program.cs b/RenderTarget2DSample/Program.cs
index bbe9bf59..c66959c9 100644
--- a/RenderTarget2DSample/Program.cs
+++ b/RenderTarget2DSample/Program.cs
@@ -1,6 +1,6 @@
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -9,7 +9,7 @@
namespace RenderTarget2DSample
{
#region Entry Point
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -31,7 +31,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1 ();
game.Run ();
diff --git a/RolePlayingGame/Combat/ArtificialIntelligence.cs b/RolePlayingGame/Combat/ArtificialIntelligence.cs
index a374f188..4ab5aa9f 100644
--- a/RolePlayingGame/Combat/ArtificialIntelligence.cs
+++ b/RolePlayingGame/Combat/ArtificialIntelligence.cs
@@ -59,7 +59,7 @@ public ArtificialIntelligence(CombatantMonster monster)
// check the parameter
if (monster == null)
{
- throw new ArgumentNullException("monster");
+ throw new ArgumentNullException(nameof (monster));
}
// assign the parameter
diff --git a/RolePlayingGame/GameScreens/ChestScreen.cs b/RolePlayingGame/GameScreens/ChestScreen.cs
index 427908c5..9c84f9d7 100644
--- a/RolePlayingGame/GameScreens/ChestScreen.cs
+++ b/RolePlayingGame/GameScreens/ChestScreen.cs
@@ -220,7 +220,7 @@ public ChestScreen(MapEntry chestEntry)
// check the parameter
if ((chestEntry == null) || (chestEntry.Content == null))
{
- throw new ArgumentNullException("chestEntry.Content");
+ throw new ArgumentNullException(nameof (chestEntry));
}
this.chestEntry = chestEntry;
@@ -584,7 +584,7 @@ protected override void DrawEntry(ContentEntry entry, Vector2 position,
// check the parameter
if (entry == null)
{
- throw new ArgumentNullException("entry");
+ throw new ArgumentNullException(nameof (entry));
}
Gear gear = entry.Content as Gear;
if (gear == null)
diff --git a/RolePlayingGame/Info.plist b/RolePlayingGame/Info.plist
index 961c253c..a0bbcf31 100644
--- a/RolePlayingGame/Info.plist
+++ b/RolePlayingGame/Info.plist
@@ -9,7 +9,7 @@
CFBundleVersion
1
LSMinimumSystemVersion
- 10.6
+ 10.9
NSPrincipalClass
NSApplication
diff --git a/RolePlayingGame/Program.cs b/RolePlayingGame/Program.cs
index 88eca936..5264c313 100644
--- a/RolePlayingGame/Program.cs
+++ b/RolePlayingGame/Program.cs
@@ -48,14 +48,11 @@ purpose and non-infringement.
#region Using Statements
using System;
using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Net;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+using Foundation;
+using AppKit;
#endregion
@@ -83,7 +80,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
RolePlayingGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new RolePlayingGame();
game.Run();
diff --git a/RolePlayingGame/RolePlayingGame.MacOS.csproj b/RolePlayingGame/RolePlayingGame.MacOS.csproj
index 1a997503..4c057441 100644
--- a/RolePlayingGame/RolePlayingGame.MacOS.csproj
+++ b/RolePlayingGame/RolePlayingGame.MacOS.csproj
@@ -1,15 +1,19 @@
+
Debug
AnyCPU
10.0.0
2.0
{75200892-E593-49EE-82D5-F59DB45883AD}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
RolePlayingGame
RolePlayingGame
+ True
+ v2.0
+ Xamarin.Mac
True
@@ -25,6 +29,9 @@
False
False
False
+ HttpClientHandler
+ None
+ None
none
@@ -38,14 +45,19 @@
False
False
False
+ HttpClientHandler
+ None
+ None
-
-
+
+
+ ..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\XamarinMac\MonoGame.Framework.dll
+
@@ -1084,9 +1096,10 @@
+
-
-
+
+
@@ -2165,13 +2178,6 @@
{098BBC2D-63A6-4C22-8A30-E6C4F4FC0AC4}
RolePlayingGameData
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
+
diff --git a/RolePlayingGame/RolePlayingGame.cs b/RolePlayingGame/RolePlayingGame.cs
index 6175e28f..11a8606b 100644
--- a/RolePlayingGame/RolePlayingGame.cs
+++ b/RolePlayingGame/RolePlayingGame.cs
@@ -14,9 +14,7 @@
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
-using Microsoft.Xna.Framework.Storage;
using RolePlayingGameData;
-using Microsoft.Xna.Framework.GamerServices;
#endregion
namespace RolePlaying
diff --git a/RolePlayingGame/RolePlayingGameData/Animation/AnimatingSprite.cs b/RolePlayingGame/RolePlayingGameData/Animation/AnimatingSprite.cs
index 986c0c2b..6b6600d1 100644
--- a/RolePlayingGame/RolePlayingGameData/Animation/AnimatingSprite.cs
+++ b/RolePlayingGame/RolePlayingGameData/Animation/AnimatingSprite.cs
@@ -257,7 +257,7 @@ public void PlayAnimation(string name)
// check the parameter
if (String.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof (name));
}
PlayAnimation(this[name]);
@@ -276,7 +276,7 @@ public void PlayAnimation(string name, Direction direction)
// check the parameter
if (String.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof (name));
}
PlayAnimation(name + direction.ToString());
@@ -408,7 +408,7 @@ public void Draw(SpriteBatch spriteBatch, Vector2 position, float layerDepth,
// check the parameters
if (spriteBatch == null)
{
- throw new ArgumentNullException("spriteBatch");
+ throw new ArgumentNullException(nameof (spriteBatch));
}
if (texture != null)
diff --git a/RolePlayingGame/RolePlayingGameData/Characters/Character.cs b/RolePlayingGame/RolePlayingGameData/Characters/Character.cs
index 83ea1697..c1ef0f9e 100644
--- a/RolePlayingGame/RolePlayingGameData/Characters/Character.cs
+++ b/RolePlayingGame/RolePlayingGameData/Characters/Character.cs
@@ -342,7 +342,7 @@ protected override Character Read(ContentReader input,
Character character = existingInstance;
if (character == null)
{
- throw new ArgumentNullException("existingInstance");
+ throw new ArgumentNullException(nameof (character));
}
input.ReadRawObject(character as WorldObject);
diff --git a/RolePlayingGame/RolePlayingGameData/RolePlayingGameData.csproj b/RolePlayingGame/RolePlayingGameData/RolePlayingGameData.csproj
index fbcdfa99..d17814d1 100644
--- a/RolePlayingGame/RolePlayingGameData/RolePlayingGameData.csproj
+++ b/RolePlayingGame/RolePlayingGameData/RolePlayingGameData.csproj
@@ -31,9 +31,11 @@
-
+
+ ..\..\packages\MonoGame.Framework.MacOS.3.7.1.189\lib\net40\MonoGame.Framework.dll
+
@@ -81,15 +83,7 @@
+
-
-
- {36C538E6-C32A-4A8D-A39C-566173D7118E}
- MonoGame.Framework.MacOS
-
-
- {AE483C29-042E-4226-BA52-D247CE7676DA}
- Lidgren.Network.MacOS
-
-
+
diff --git a/RolePlayingGame/RolePlayingGameData/packages.config b/RolePlayingGame/RolePlayingGameData/packages.config
new file mode 100644
index 00000000..3f31b994
--- /dev/null
+++ b/RolePlayingGame/RolePlayingGameData/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/RolePlayingGame/Session/Session.cs b/RolePlayingGame/Session/Session.cs
index 2e8b26e4..6a289a42 100644
--- a/RolePlayingGame/Session/Session.cs
+++ b/RolePlayingGame/Session/Session.cs
@@ -17,7 +17,6 @@
using System.Xml.Serialization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using RolePlayingGameData;
diff --git a/RolePlayingGame/packages.config b/RolePlayingGame/packages.config
new file mode 100644
index 00000000..dc30b22c
--- /dev/null
+++ b/RolePlayingGame/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/ShadowMapping/Main.cs b/ShadowMapping/Main.cs
index 68fc7871..b3b4b8e1 100644
--- a/ShadowMapping/Main.cs
+++ b/ShadowMapping/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace ShadowMapping
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
ShadowMappingGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new ShadowMappingGame ();
game.Run ();
diff --git a/ShatterEffectSample/Main.cs b/ShatterEffectSample/Main.cs
index 94f3bc78..e7a66182 100644
--- a/ShatterEffectSample/Main.cs
+++ b/ShatterEffectSample/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace ShatterSample
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
ShatterEffectGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new ShatterEffectGame ();
game.Run ();
diff --git a/SpriteEffects/Program.cs b/SpriteEffects/Program.cs
index 28a34ca1..daa3fcb8 100755
--- a/SpriteEffects/Program.cs
+++ b/SpriteEffects/Program.cs
@@ -2,14 +2,14 @@
using System.Collections.Generic;
using System.Linq;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
namespace SpriteEffects
{
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -31,7 +31,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
SpriteEffectsGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new SpriteEffectsGame();
game.Run();
diff --git a/StarWarrior/Program.cs b/StarWarrior/Program.cs
index 17fc779e..62d1b3b5 100644
--- a/StarWarrior/Program.cs
+++ b/StarWarrior/Program.cs
@@ -2,15 +2,15 @@
using System.Collections.Generic;
using System.Linq;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
namespace StarWarrior
{
#region Entry Point
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -32,7 +32,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
Game1 game = new Game1 ();
game.Run ();
diff --git a/StencilsCratersTutorial/Program.cs b/StencilsCratersTutorial/Program.cs
index b57a0b23..9802e084 100644
--- a/StencilsCratersTutorial/Program.cs
+++ b/StencilsCratersTutorial/Program.cs
@@ -17,7 +17,7 @@ static void Main(string[] args)
}
}
#endif
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -25,25 +25,25 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
Game1 game = new Game1 ();
game.Run ();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/Tetris/Program.cs b/Tetris/Program.cs
index 6aca2e38..33294ff5 100755
--- a/Tetris/Program.cs
+++ b/Tetris/Program.cs
@@ -3,14 +3,14 @@
using System.Linq;
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#endif
namespace Tetris
{
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -32,7 +32,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
Engine game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Engine();
game.Run();
diff --git a/TexturedQuad/Game1.cs b/TexturedQuad/Game1.cs
index 37e7851e..76781305 100755
Binary files a/TexturedQuad/Game1.cs and b/TexturedQuad/Game1.cs differ
diff --git a/TexturedQuad/Program.cs b/TexturedQuad/Program.cs
index 4e580dc6..1f36c4ee 100755
Binary files a/TexturedQuad/Program.cs and b/TexturedQuad/Program.cs differ
diff --git a/TiledSprites/AnimatedSprite.cs b/TiledSprites/AnimatedSprite.cs
index e7ffd7ab..65172812 100755
--- a/TiledSprites/AnimatedSprite.cs
+++ b/TiledSprites/AnimatedSprite.cs
@@ -110,7 +110,7 @@ public AnimatedSprite (SpriteSheet spriteSheet, int frameWidth,
int frameHeight,int padding,int rows,int columns,
Point startFrame,int frames) {
if (spriteSheet == null) {
- throw new ArgumentNullException ("spriteSheet");
+ throw new ArgumentNullException (nameof(spriteSheet));
}
int spriteAreaHeight = (frameHeight + padding) * rows - padding;
int spriteAreaWidth = (frameWidth + padding) * columns - padding;
diff --git a/TransformedCollisionSample/Program.cs b/TransformedCollisionSample/Program.cs
index 95d76a16..0514759f 100755
--- a/TransformedCollisionSample/Program.cs
+++ b/TransformedCollisionSample/Program.cs
@@ -10,10 +10,10 @@
#region Using Statements
using System;
-#if MONOMAC
-using MonoMac.Foundation;
-using MonoMac.AppKit;
-using MonoMac.ObjCRuntime;
+#if __MACOS__
+using Foundation;
+using AppKit;
+using ObjCRuntime;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -22,7 +22,7 @@
namespace TransformedCollision
{
-#if MONOMAC
+#if __MACOS__
static class Program
{
///
@@ -42,7 +42,7 @@ static void Main (string[] args)
class AppDelegate : NSApplicationDelegate
{
TransformedCollisionGame game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new TransformedCollisionGame();
game.Run();
diff --git a/UseCustomVertex/Game1.cs b/UseCustomVertex/Game1.cs
index 6cf97e18..423a1a8d 100755
Binary files a/UseCustomVertex/Game1.cs and b/UseCustomVertex/Game1.cs differ
diff --git a/UseCustomVertex/Program.cs b/UseCustomVertex/Program.cs
index 3492c57e..dbaf2b39 100755
--- a/UseCustomVertex/Program.cs
+++ b/UseCustomVertex/Program.cs
@@ -26,7 +26,7 @@ static void Main(string[] args)
}
}
#endif
-#if MONOMAC
+#if __MACOS__
static class Program
{
@@ -35,25 +35,25 @@ static class Program
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
- MonoMac.AppKit.NSApplication.Main(args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate();
+ AppKit.NSApplication.Main(args);
}
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}
diff --git a/VideoPlayer/main.cs b/VideoPlayer/main.cs
index 85a76db5..14bc9659 100644
--- a/VideoPlayer/main.cs
+++ b/VideoPlayer/main.cs
@@ -1,6 +1,6 @@
-#if MONOMAC
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+#if __MACOS__
+using AppKit;
+using Foundation;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
@@ -8,7 +8,7 @@
namespace MonoGame.Samples.VideoPlayer
{
-#if MONOMAC
+#if __MACOS__
class Program
{
static void Main (string[] args)
@@ -31,7 +31,7 @@ class AppDelegate : NSApplicationDelegate
{
private Game1 game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new Game1();
game.Run();
diff --git a/XNA2DShaderExamples/Main.cs b/XNA2DShaderExamples/Main.cs
index 501cea4b..41a82d10 100644
--- a/XNA2DShaderExamples/Main.cs
+++ b/XNA2DShaderExamples/Main.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
namespace ShaderTests
{
@@ -29,7 +29,7 @@ class AppDelegate : NSApplicationDelegate
{
ShaderTest game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new ShaderTest ();
game.Run ();
diff --git a/XNAPacMan/Program.cs b/XNAPacMan/Program.cs
index 6d68d6d1..0e4ff569 100644
--- a/XNAPacMan/Program.cs
+++ b/XNAPacMan/Program.cs
@@ -8,26 +8,26 @@ static class Program {
///
static void Main (string[] args)
{
- MonoMac.AppKit.NSApplication.Init ();
+ AppKit.NSApplication.Init ();
- using (var p = new MonoMac.Foundation.NSAutoreleasePool ()) {
- MonoMac.AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate ();
- MonoMac.AppKit.NSApplication.Main (args);
+ using (var p = new Foundation.NSAutoreleasePool ()) {
+ AppKit.NSApplication.SharedApplication.Delegate = new AppDelegate ();
+ AppKit.NSApplication.Main (args);
}
}
- class AppDelegate : MonoMac.AppKit.NSApplicationDelegate
+ class AppDelegate : AppKit.NSApplicationDelegate
{
XNAPacMan game;
- public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+ public override void DidFinishLaunching (NSNotification notification)
{
game = new XNAPacMan();
game.Run();
}
- public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.AppKit.NSApplication sender)
+ public override bool ApplicationShouldTerminateAfterLastWindowClosed (AppKit.NSApplication sender)
{
return true;
}