Procházet zdrojové kódy

Primitives updated to SDK and MG 3.8.*

CartBlanche před 2 týdny
rodič
revize
c42c0d0d3f
30 změnil soubory, kde provedl 1188 přidání a 811 odebrání
  1. 50 0
      Primitives/.vscode/launch.json
  2. 108 0
      Primitives/.vscode/tasks.json
  3. 0 34
      Primitives/Activity1.cs
  4. 0 0
      Primitives/Core/Content/Game.ico
  5. 0 0
      Primitives/Core/Content/GameThumbnail.png
  6. 240 248
      Primitives/Core/PrimitiveBatch.cs
  7. 11 0
      Primitives/Core/Primitives.Core.csproj
  8. 294 307
      Primitives/Core/PrimitivesSampleGame.cs
  9. 0 0
      Primitives/Platforms/Android/AndroidManifest.xml
  10. 24 0
      Primitives/Platforms/Android/MainActivity.cs
  11. 24 0
      Primitives/Platforms/Android/Primitives.Android.csproj
  12. 0 0
      Primitives/Platforms/Android/Resources/AboutResources.txt
  13. 0 0
      Primitives/Platforms/Android/Resources/Resource.designer.cs
  14. 0 0
      Primitives/Platforms/Android/Resources/drawable/Icon.png
  15. 0 0
      Primitives/Platforms/Android/Resources/layout/Main.axml
  16. 0 0
      Primitives/Platforms/Android/Resources/values/Strings.xml
  17. 28 0
      Primitives/Platforms/Desktop/Primitives.DesktopGL.csproj
  18. 14 0
      Primitives/Platforms/Desktop/Program.cs
  19. 30 0
      Primitives/Platforms/Windows/Primitives.Windows.csproj
  20. 15 0
      Primitives/Platforms/Windows/Program.cs
  21. 19 0
      Primitives/Platforms/iOS/AppDelegate.cs
  22. 0 0
      Primitives/Platforms/iOS/Info.plist
  23. 22 0
      Primitives/Platforms/iOS/Primitives.iOS.csproj
  24. 13 0
      Primitives/Platforms/iOS/Program.cs
  25. 0 77
      Primitives/Primitives.Android.csproj
  26. 0 73
      Primitives/Primitives.MacOS.csproj
  27. 116 0
      Primitives/Primitives.sln
  28. 0 42
      Primitives/Program.cs
  29. 0 30
      Primitives/Properties/AssemblyInfo.cs
  30. 180 0
      Primitives/README.md

+ 50 - 0
Primitives/.vscode/launch.json

@@ -0,0 +1,50 @@
+{
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Launch Windows",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build-windows",
+            "program": "${workspaceFolder}/Platforms/Windows/bin/Debug/net8.0-windows/Primitives.Windows.exe",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "console": "internalConsole",
+            "stopAtEntry": false
+        },
+        {
+            "name": "Launch DesktopGL",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build-desktopgl",
+            "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net8.0/Primitives.DesktopGL.exe",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "console": "internalConsole",
+            "stopAtEntry": false
+        }
+        ,
+        {
+            "name": "Launch Android",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build-android",
+            "program": "${workspaceFolder}/Platforms/Android/bin/Debug/net8.0-android/Primitives.Android.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "console": "internalConsole",
+            "stopAtEntry": false
+        },
+        {
+            "name": "Launch iOS",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build-ios",
+            "program": "${workspaceFolder}/Platforms/iOS/bin/Debug/net8.0-ios/Primitives.iOS.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "console": "internalConsole",
+            "stopAtEntry": false
+        }
+    ]
+}

+ 108 - 0
Primitives/.vscode/tasks.json

@@ -0,0 +1,108 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "build-windows",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["build", "Platforms/Windows/Primitives.Windows.csproj"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "build-desktopgl",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["build", "Platforms/Desktop/Primitives.DesktopGL.csproj"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "build-android",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["build", "Platforms/Android/Primitives.Android.csproj"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "build-all",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["build", "Primitives.sln"],
+            "group": {
+                "kind": "build",
+                "isDefault": true
+            },
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "run-windows",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["run", "--project", "Platforms/Windows/Primitives.Windows.csproj"],
+            "group": "test",
+            "dependsOn": "build-windows",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "run-desktopgl",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["run", "--project", "Platforms/Desktop/Primitives.DesktopGL.csproj"],
+            "group": "test",
+            "dependsOn": "build-desktopgl",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "build-android",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["build", "Platforms/Android/Primitives.Android.csproj"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "run-android",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["run", "--project", "Platforms/Android/Primitives.Android.csproj"],
+            "group": "test",
+            "dependsOn": "build-android",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "build-ios",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["build", "Platforms/iOS/Primitives.iOS.csproj"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "run-ios",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["run", "--project", "Platforms/iOS/Primitives.iOS.csproj"],
+            "group": "test",
+            "dependsOn": "build-ios",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "clean",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["clean", "Primitives.sln"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "restore",
+            "type": "shell",
+            "command": "dotnet",
+            "args": ["restore", "Primitives.sln"],
+            "group": "build",
+            "problemMatcher": "$msCompile"
+        }
+    ]
+}

+ 0 - 34
Primitives/Activity1.cs

@@ -1,34 +0,0 @@
-using System;
-
-using Android.App;
-using Android.Content;
-using Android.Content.PM;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using Android.OS;
-using Microsoft.Xna.Framework;
-using PrimitivesSample;
-
-namespace MonoGame.Samples.Primitives.Android
-{
-	[Activity (Label = "MonoGame.Samples.Primitives.Android", 
-	           MainLauncher = true,
-	           ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.Keyboard|ConfigChanges.KeyboardHidden
-	           ,ScreenOrientation=ScreenOrientation.Landscape)]
-	public class Activity1 : AndroidGameActivity
-	{
-		protected override void OnCreate (Bundle bundle)
-		{
-			base.OnCreate (bundle);
-
-			// Create our OpenGL view, and display it
-			PrimitivesSampleGame.Activity = this;
-			var g = new PrimitivesSampleGame();
-			SetContentView (g.Window);
-			g.Run();
-		}
-	}
-}
-
-

+ 0 - 0
Primitives/Game.ico → Primitives/Core/Content/Game.ico


+ 0 - 0
Primitives/GameThumbnail.png → Primitives/Core/Content/GameThumbnail.png


+ 240 - 248
Primitives/PrimitiveBatch.cs → Primitives/Core/PrimitiveBatch.cs

@@ -1,248 +1,240 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// PrimitiveBatch.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Input;
-#endregion
-
-namespace PrimitivesSample
-{
-
-    // PrimitiveBatch is a class that handles efficient rendering automatically for its
-    // users, in a similar way to SpriteBatch. PrimitiveBatch can render lines, points,
-    // and triangles to the screen. In this sample, it is used to draw a spacewars
-    // retro scene.
-    public class PrimitiveBatch : IDisposable
-    {
-        #region Constants and Fields
-
-        // this constant controls how large the vertices buffer is. Larger buffers will
-        // require flushing less often, which can increase performance. However, having
-        // buffer that is unnecessarily large will waste memory.
-        const int DefaultBufferSize = 500;
-
-        // a block of vertices that calling AddVertex will fill. Flush will draw using
-        // this array, and will determine how many primitives to draw from
-        // positionInBuffer.
-        VertexPositionColor[] vertices = new VertexPositionColor[DefaultBufferSize];
-
-        // keeps track of how many vertices have been added. this value increases until
-        // we run out of space in the buffer, at which time Flush is automatically
-        // called.
-        int positionInBuffer = 0;
-
-        // a basic effect, which contains the shaders that we will use to draw our
-        // primitives.
-        BasicEffect basicEffect;
-
-        // the device that we will issue draw calls to.
-        GraphicsDevice device;
-
-        // this value is set by Begin, and is the type of primitives that we are
-        // drawing.
-        PrimitiveType primitiveType;
-
-        // how many verts does each of these primitives take up? points are 1,
-        // lines are 2, and triangles are 3.
-        int numVertsPerPrimitive;
-
-        // hasBegun is flipped to true once Begin is called, and is used to make
-        // sure users don't call End before Begin is called.
-        bool hasBegun = false;
-
-        bool isDisposed = false;
-
-        #endregion
-
-        // the constructor creates a new PrimitiveBatch and sets up all of the internals
-        // that PrimitiveBatch will need.
-        public PrimitiveBatch(GraphicsDevice graphicsDevice)
-        {
-            if (graphicsDevice == null)
-            {
-                throw new ArgumentNullException("graphicsDevice");
-            }
-            device = graphicsDevice;
-
-            // set up a new basic effect, and enable vertex colors.
-            basicEffect = new BasicEffect(graphicsDevice);
-            basicEffect.VertexColorEnabled = true;
-
-            // projection uses CreateOrthographicOffCenter to create 2d projection
-            // matrix with 0,0 in the upper left.
-            basicEffect.Projection = Matrix.CreateOrthographicOffCenter
-                (0, graphicsDevice.Viewport.Width,
-                graphicsDevice.Viewport.Height, 0,
-                0, 1);
-            this.basicEffect.World = Matrix.Identity;
-            this.basicEffect.View = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward,
-                Vector3.Up);
-        }
-
-        public void Dispose()
-        {
-            this.Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (disposing && !isDisposed)
-            {
-                if (basicEffect != null)
-                    basicEffect.Dispose();
-
-                isDisposed = true;
-            }
-        }
-
-        // Begin is called to tell the PrimitiveBatch what kind of primitives will be
-        // drawn, and to prepare the graphics card to render those primitives.
-        public void Begin(PrimitiveType primitiveType)
-        {
-            if (hasBegun)
-            {
-                throw new InvalidOperationException
-                    ("End must be called before Begin can be called again.");
-            }
-
-            // these three types reuse vertices, so we can't flush properly without more
-            // complex logic. Since that's a bit too complicated for this sample, we'll
-            // simply disallow them.
-            if (primitiveType == PrimitiveType.LineStrip ||
-                primitiveType == PrimitiveType.TriangleStrip)
-            {
-                throw new NotSupportedException
-                    ("The specified primitiveType is not supported by PrimitiveBatch.");
-            }
-
-            this.primitiveType = primitiveType;
-
-            // how many verts will each of these primitives require?
-            this.numVertsPerPrimitive = NumVertsPerPrimitive(primitiveType);
-
-            //tell our basic effect to begin.
-            basicEffect.CurrentTechnique.Passes[0].Apply();
-
-            // flip the error checking boolean. It's now ok to call AddVertex, Flush,
-            // and End.
-            hasBegun = true;
-        }
-
-        // AddVertex is called to add another vertex to be rendered. To draw a point,
-        // AddVertex must be called once. for lines, twice, and for triangles 3 times.
-        // this function can only be called once begin has been called.
-        // if there is not enough room in the vertices buffer, Flush is called
-        // automatically.
-        public void AddVertex(Vector2 vertex, Color color)
-        {
-            if (!hasBegun)
-            {
-                throw new InvalidOperationException
-                    ("Begin must be called before AddVertex can be called.");
-            }
-
-            // are we starting a new primitive? if so, and there will not be enough room
-            // for a whole primitive, flush.
-            bool newPrimitive = ((positionInBuffer % numVertsPerPrimitive) == 0);
-
-            if (newPrimitive &&
-                (positionInBuffer + numVertsPerPrimitive) >= vertices.Length)
-            {
-                Flush();
-            }
-
-            // once we know there's enough room, set the vertex in the buffer,
-            // and increase position.
-            vertices[positionInBuffer].Position = new Vector3(vertex, 0);
-            vertices[positionInBuffer].Color = color;
-
-            positionInBuffer++;
-        }
-
-        // End is called once all the primitives have been drawn using AddVertex.
-        // it will call Flush to actually submit the draw call to the graphics card, and
-        // then tell the basic effect to end.
-        public void End()
-        {
-            if (!hasBegun)
-            {
-                throw new InvalidOperationException
-                    ("Begin must be called before End can be called.");
-            }
-
-            // Draw whatever the user wanted us to draw
-            Flush();
-
-            hasBegun = false;
-        }
-
-        // Flush is called to issue the draw call to the graphics card. Once the draw
-        // call is made, positionInBuffer is reset, so that AddVertex can start over
-        // at the beginning. End will call this to draw the primitives that the user
-        // requested, and AddVertex will call this if there is not enough room in the
-        // buffer.
-        private void Flush()
-        {
-            if (!hasBegun)
-            {
-                throw new InvalidOperationException
-                    ("Begin must be called before Flush can be called.");
-            }
-
-            // no work to do
-            if (positionInBuffer == 0)
-            {
-                return;
-            }
-
-            // how many primitives will we draw?
-            int primitiveCount = positionInBuffer / numVertsPerPrimitive;
-
-            // submit the draw call to the graphics card
-            device.DrawUserPrimitives<VertexPositionColor>(primitiveType, vertices, 0,
-                primitiveCount);
-
-            // now that we've drawn, it's ok to reset positionInBuffer back to zero,
-            // and write over any vertices that may have been set previously.
-            positionInBuffer = 0;
-        }
-
-        #region Helper functions
-
-        // NumVertsPerPrimitive is a boring helper function that tells how many vertices
-        // it will take to draw each kind of primitive.
-        static private int NumVertsPerPrimitive(PrimitiveType primitive)
-        {
-            int numVertsPerPrimitive;
-            switch (primitive)
-            {
-                case PrimitiveType.LineList:
-                    numVertsPerPrimitive = 2;
-                    break;
-                case PrimitiveType.TriangleList:
-                    numVertsPerPrimitive = 3;
-                    break;
-                default:
-                    throw new InvalidOperationException("primitive is not valid");
-            }
-            return numVertsPerPrimitive;
-        }
-
-        #endregion
-
-
-    }
-}
+//-----------------------------------------------------------------------------
+// PrimitiveBatch.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Input;
+
+namespace PrimitivesSample
+{
+
+    // PrimitiveBatch is a class that handles efficient rendering automatically for its
+    // users, in a similar way to SpriteBatch. PrimitiveBatch can render lines, points,
+    // and triangles to the screen. In this sample, it is used to draw a spacewars
+    // retro scene.
+    public class PrimitiveBatch : IDisposable
+    {
+
+        // this constant controls how large the vertices buffer is. Larger buffers will
+        // require flushing less often, which can increase performance. However, having
+        // buffer that is unnecessarily large will waste memory.
+        const int DefaultBufferSize = 500;
+
+        // a block of vertices that calling AddVertex will fill. Flush will draw using
+        // this array, and will determine how many primitives to draw from
+        // positionInBuffer.
+        VertexPositionColor[] vertices = new VertexPositionColor[DefaultBufferSize];
+
+        // keeps track of how many vertices have been added. this value increases until
+        // we run out of space in the buffer, at which time Flush is automatically
+        // called.
+        int positionInBuffer = 0;
+
+        // a basic effect, which contains the shaders that we will use to draw our
+        // primitives.
+        BasicEffect basicEffect;
+
+        // the device that we will issue draw calls to.
+        GraphicsDevice device;
+
+        // this value is set by Begin, and is the type of primitives that we are
+        // drawing.
+        PrimitiveType primitiveType;
+
+        // how many verts does each of these primitives take up? points are 1,
+        // lines are 2, and triangles are 3.
+        int numVertsPerPrimitive;
+
+        // hasBegun is flipped to true once Begin is called, and is used to make
+        // sure users don't call End before Begin is called.
+        bool hasBegun = false;
+
+        bool isDisposed = false;
+
+
+        // the constructor creates a new PrimitiveBatch and sets up all of the internals
+        // that PrimitiveBatch will need.
+        public PrimitiveBatch(GraphicsDevice graphicsDevice)
+        {
+            if (graphicsDevice == null)
+            {
+                throw new ArgumentNullException("graphicsDevice");
+            }
+            device = graphicsDevice;
+
+            // set up a new basic effect, and enable vertex colors.
+            basicEffect = new BasicEffect(graphicsDevice);
+            basicEffect.VertexColorEnabled = true;
+
+            // projection uses CreateOrthographicOffCenter to create 2d projection
+            // matrix with 0,0 in the upper left.
+            basicEffect.Projection = Matrix.CreateOrthographicOffCenter
+                (0, graphicsDevice.Viewport.Width,
+                graphicsDevice.Viewport.Height, 0,
+                0, 1);
+            this.basicEffect.World = Matrix.Identity;
+            this.basicEffect.View = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward,
+                Vector3.Up);
+        }
+
+        public void Dispose()
+        {
+            this.Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing && !isDisposed)
+            {
+                if (basicEffect != null)
+                    basicEffect.Dispose();
+
+                isDisposed = true;
+            }
+        }
+
+        // Begin is called to tell the PrimitiveBatch what kind of primitives will be
+        // drawn, and to prepare the graphics card to render those primitives.
+        public void Begin(PrimitiveType primitiveType)
+        {
+            if (hasBegun)
+            {
+                throw new InvalidOperationException
+                    ("End must be called before Begin can be called again.");
+            }
+
+            // these three types reuse vertices, so we can't flush properly without more
+            // complex logic. Since that's a bit too complicated for this sample, we'll
+            // simply disallow them.
+            if (primitiveType == PrimitiveType.LineStrip ||
+                primitiveType == PrimitiveType.TriangleStrip)
+            {
+                throw new NotSupportedException
+                    ("The specified primitiveType is not supported by PrimitiveBatch.");
+            }
+
+            this.primitiveType = primitiveType;
+
+            // how many verts will each of these primitives require?
+            this.numVertsPerPrimitive = NumVertsPerPrimitive(primitiveType);
+
+            //tell our basic effect to begin.
+            basicEffect.CurrentTechnique.Passes[0].Apply();
+
+            // flip the error checking boolean. It's now ok to call AddVertex, Flush,
+            // and End.
+            hasBegun = true;
+        }
+
+        // AddVertex is called to add another vertex to be rendered. To draw a point,
+        // AddVertex must be called once. for lines, twice, and for triangles 3 times.
+        // this function can only be called once begin has been called.
+        // if there is not enough room in the vertices buffer, Flush is called
+        // automatically.
+        public void AddVertex(Vector2 vertex, Color color)
+        {
+            if (!hasBegun)
+            {
+                throw new InvalidOperationException
+                    ("Begin must be called before AddVertex can be called.");
+            }
+
+            // are we starting a new primitive? if so, and there will not be enough room
+            // for a whole primitive, flush.
+            bool newPrimitive = ((positionInBuffer % numVertsPerPrimitive) == 0);
+
+            if (newPrimitive &&
+                (positionInBuffer + numVertsPerPrimitive) >= vertices.Length)
+            {
+                Flush();
+            }
+
+            // once we know there's enough room, set the vertex in the buffer,
+            // and increase position.
+            vertices[positionInBuffer].Position = new Vector3(vertex, 0);
+            vertices[positionInBuffer].Color = color;
+
+            positionInBuffer++;
+        }
+
+        // End is called once all the primitives have been drawn using AddVertex.
+        // it will call Flush to actually submit the draw call to the graphics card, and
+        // then tell the basic effect to end.
+        public void End()
+        {
+            if (!hasBegun)
+            {
+                throw new InvalidOperationException
+                    ("Begin must be called before End can be called.");
+            }
+
+            // Draw whatever the user wanted us to draw
+            Flush();
+
+            hasBegun = false;
+        }
+
+        // Flush is called to issue the draw call to the graphics card. Once the draw
+        // call is made, positionInBuffer is reset, so that AddVertex can start over
+        // at the beginning. End will call this to draw the primitives that the user
+        // requested, and AddVertex will call this if there is not enough room in the
+        // buffer.
+        private void Flush()
+        {
+            if (!hasBegun)
+            {
+                throw new InvalidOperationException
+                    ("Begin must be called before Flush can be called.");
+            }
+
+            // no work to do
+            if (positionInBuffer == 0)
+            {
+                return;
+            }
+
+            // how many primitives will we draw?
+            int primitiveCount = positionInBuffer / numVertsPerPrimitive;
+
+            // submit the draw call to the graphics card
+            device.DrawUserPrimitives<VertexPositionColor>(primitiveType, vertices, 0,
+                primitiveCount);
+
+            // now that we've drawn, it's ok to reset positionInBuffer back to zero,
+            // and write over any vertices that may have been set previously.
+            positionInBuffer = 0;
+        }
+
+
+        // NumVertsPerPrimitive is a boring helper function that tells how many vertices
+        // it will take to draw each kind of primitive.
+        static private int NumVertsPerPrimitive(PrimitiveType primitive)
+        {
+            int numVertsPerPrimitive;
+            switch (primitive)
+            {
+                case PrimitiveType.LineList:
+                    numVertsPerPrimitive = 2;
+                    break;
+                case PrimitiveType.TriangleList:
+                    numVertsPerPrimitive = 3;
+                    break;
+                default:
+                    throw new InvalidOperationException("primitive is not valid");
+            }
+            return numVertsPerPrimitive;
+        }
+
+
+
+    }
+}

+ 11 - 0
Primitives/Core/Primitives.Core.csproj

@@ -0,0 +1,11 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <AssemblyName>Primitives.Core</AssemblyName>
+    <RootNamespace>PrimitivesSample.Core</RootNamespace>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.*" />
+  </ItemGroup>
+</Project>

+ 294 - 307
Primitives/PrimitivesSampleGame.cs → Primitives/Core/PrimitivesSampleGame.cs

@@ -1,307 +1,294 @@
-#region File Description
-//-----------------------------------------------------------------------------
-// PrimitivesSampleGame.cs
-//
-// Microsoft XNA Community Game Platform
-// Copyright (C) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-#endregion
-
-#region Using Statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Input;
-#endregion
-
-namespace PrimitivesSample
-{
-    // This sample illustrates the use of PrimitiveBatch to draw lines and points
-    // on the screen. Lines and points are used to recreate the Spacewars starter kit's
-    // retro mode.
-    public class PrimitivesSampleGame : Microsoft.Xna.Framework.Game
-    {
-        #region Constants
-
-        // this constant controls the number of stars that will be created when the game
-        // starts up.
-        const int NumStars = 500;
-
-        // what percentage of those stars will be "big" stars? the default is 20%.
-        const float PercentBigStars = .2f;
-
-        // how bright will stars be?  somewhere between these two values.
-        const byte MinimumStarBrightness = 56;
-        const byte MaximumStarBrightness = 255;
-
-        // how big is the ship?
-        const float ShipSizeX = 10f;
-        const float ShipSizeY = 15f;
-        const float ShipCutoutSize = 5f;
-
-        // the radius of the sun.
-        const float SunSize = 30f;
-
-        #endregion
-
-        #region Fields
-
-        GraphicsDeviceManager graphics;
-
-        // PrimitiveBatch is the new class introduced in this sample. We'll use it to
-        // draw everything in this sample, including the stars, ships, and sun.
-        PrimitiveBatch primitiveBatch;
-
-        // these two lists, stars, and starColors, keep track of the positions and
-        // colors of all the stars that we will randomly generate during the initialize
-        // phase.
-        List<Vector2> stars = new List<Vector2>();
-        List<Color> starColors = new List<Color>();
-
-        #endregion
-
-        #region Initialization
-        public PrimitivesSampleGame()
-        {
-            graphics = new GraphicsDeviceManager(this);
-            Content.RootDirectory = "Content";
-
-#if WINDOWS_PHONE || IPHONE
-            TargetElapsedTime = TimeSpan.FromTicks(333333);
-
-            graphics.PreferredBackBufferWidth = 480;
-            graphics.PreferredBackBufferHeight = 800;
-            graphics.IsFullScreen = true;
-#else
-            // set the backbuffer size to something that will work well on both xbox
-            // and windows.
-            graphics.PreferredBackBufferWidth = 853;
-            graphics.PreferredBackBufferHeight = 480;
-#endif
-        }
-
-        protected override void Initialize()
-        {
-            base.Initialize();
-
-            // CreateStars needs to know how big the GraphicsDevice's viewport is, so 
-            // once base.Initialize has been called, we can call this.
-            CreateStars();
-        }
-
-        private void CreateStars()
-        {
-            // since every star will be put in a random place and have a random color, 
-            // a random number generator might come in handy.
-            Random random = new Random();
-
-            // where can we put the stars?
-            int screenWidth = graphics.GraphicsDevice.Viewport.Width;
-            int screenHeight = graphics.GraphicsDevice.Viewport.Height;
-
-
-            for (int i = 0; i < NumStars; i++)
-            {
-                // pick a random spot...
-                Vector2 where = new Vector2(
-                    random.Next(0, screenWidth),
-                    random.Next(0, screenHeight));
-
-                // ...and a random color. it's safe to cast random.Next to a byte,
-                // because MinimumStarBrightness and MaximumStarBrightness are both
-                // bytes.
-                byte greyValue =
-                    (byte)random.Next(MinimumStarBrightness, MaximumStarBrightness);
-                Color color = new Color(greyValue, greyValue, greyValue);
-
-                // if the random number was greater than the percentage chance for a big
-                // star, this is just a normal star.
-                if ((float)random.NextDouble() > PercentBigStars)
-                {
-                    starColors.Add(color);
-                    stars.Add(where);
-                }
-                else
-                {
-                    // if this star is randomly selected to be a "big" star, we actually
-                    // add four points and colors to stars and starColors. big stars are
-                    // a block of four points, instead of just one point.
-                    for (int j = 0; j < 4; j++)
-                    {
-                        starColors.Add(color);
-                    }
-
-                    stars.Add(where);
-                    stars.Add(where + Vector2.UnitX);
-                    stars.Add(where + Vector2.UnitY);
-                    stars.Add(where + Vector2.One);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Load your graphics content.
-        /// </summary>
-        protected override void LoadContent()
-        {
-            primitiveBatch = new PrimitiveBatch(graphics.GraphicsDevice);
-        }
-
-        #endregion
-
-        #region Update and Draw
-
-        /// <summary>
-        /// Allows the game to run logic such as updating the world,
-        /// checking for collisions, gathering input and playing audio.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Update(GameTime gameTime)
-        {
-            // Allows the game to exit
-            if ((GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
-                || Keyboard.GetState().IsKeyDown(Keys.Escape))
-                this.Exit();
-
-
-            base.Update(gameTime);
-        }
-
-        /// <summary>
-        /// This is called when the game should draw itself.
-        /// </summary>
-        /// <param name="gameTime">Provides a snapshot of timing values.</param>
-        protected override void Draw(GameTime gameTime)
-        {
-            graphics.GraphicsDevice.Clear(Color.Black);
-
-            // how big is the screen? we'll use that information to center the sun
-            // and place the ships.
-            int screenWidth = graphics.GraphicsDevice.Viewport.Width;
-            int screenHeight = graphics.GraphicsDevice.Viewport.Height;
-
-            // draw the sun in the center
-            DrawSun(new Vector2(screenWidth / 2, screenHeight / 2));
-
-            // draw the left hand ship
-            DrawShip(new Vector2(100, screenHeight / 2));
-
-            // and the right hand ship
-            DrawShip(new Vector2(screenWidth - 100, screenHeight / 2));
-
-            DrawStars();
-
-            base.Draw(gameTime);
-        }
-
-        // DrawStars is called to do exactly what its name says: draw the stars.
-        private void DrawStars()
-        {
-            // stars are drawn as a list of points, so begin the primitiveBatch.
-            primitiveBatch.Begin(PrimitiveType.TriangleList);
-
-            // loop through all of the stars, and tell primitive batch to draw them.
-            // each star is a very small triangle.
-            for (int i = 0; i < stars.Count; i++)
-            {
-                primitiveBatch.AddVertex(stars[i], starColors[i]);
-                primitiveBatch.AddVertex(stars[i] + Vector2.UnitX, starColors[i]);
-                primitiveBatch.AddVertex(stars[i] + Vector2.UnitY, starColors[i]);
-            }
-
-            // and then tell it that we're done.
-            primitiveBatch.End();
-        }
-
-        // called to draw the spacewars ship at a point on the screen.
-        private void DrawShip(Vector2 where)
-        {
-            // tell the primitive batch to start drawing lines
-            primitiveBatch.Begin(PrimitiveType.LineList);
-
-            // from the nose, down the left hand side
-            primitiveBatch.AddVertex(
-                where + new Vector2(0f, -ShipSizeY), Color.White);
-            primitiveBatch.AddVertex(
-                where + new Vector2(-ShipSizeX, ShipSizeY), Color.White);
-
-            // to the right and up, into the cutout
-            primitiveBatch.AddVertex(
-                where + new Vector2(-ShipSizeX, ShipSizeY), Color.White);
-            primitiveBatch.AddVertex(
-                where + new Vector2(0f, ShipSizeY - ShipCutoutSize), Color.White);
-
-            // to the right and down, out of the cutout
-            primitiveBatch.AddVertex(
-                where + new Vector2(0f, ShipSizeY - ShipCutoutSize), Color.White);
-            primitiveBatch.AddVertex(
-                where + new Vector2(ShipSizeX, ShipSizeY), Color.White);
-
-            // and back up to the nose, where we started.
-            primitiveBatch.AddVertex(
-                where + new Vector2(ShipSizeX, ShipSizeY), Color.White);
-            primitiveBatch.AddVertex(
-                where + new Vector2(0f, -ShipSizeY), Color.White);
-
-            // and we're done.
-            primitiveBatch.End();
-        }
-
-        // called to draw the spacewars sun.
-        private void DrawSun(Vector2 where)
-        {
-            // the sun is made from 4 lines in a circle.
-            primitiveBatch.Begin(PrimitiveType.LineList);
-
-            // draw the vertical and horizontal lines
-            primitiveBatch.AddVertex(where + new Vector2(0, SunSize), Color.White);
-            primitiveBatch.AddVertex(where + new Vector2(0, -SunSize), Color.White);
-
-            primitiveBatch.AddVertex(where + new Vector2(SunSize, 0), Color.White);
-            primitiveBatch.AddVertex(where + new Vector2(-SunSize, 0), Color.White);
-
-            // to know where to draw the diagonal lines, we need to use trig.
-            // cosine of pi / 4 tells us what the x coordinate of a circle's radius is
-            // at 45 degrees. the y coordinate normally would come from sin, but sin and
-            // cos 45 are the same, so we can reuse cos for both x and y.
-            float sunSizeDiagonal = (float)Math.Cos(MathHelper.PiOver4);
-
-            // since that trig tells us the x and y for a unit circle, which has a
-            // radius of 1, we need scale that result by the sun's radius.
-            sunSizeDiagonal *= SunSize;
-
-            primitiveBatch.AddVertex(
-                where + new Vector2(-sunSizeDiagonal, sunSizeDiagonal), Color.Gray);
-            primitiveBatch.AddVertex(
-                where + new Vector2(sunSizeDiagonal, -sunSizeDiagonal), Color.Gray);
-
-            primitiveBatch.AddVertex(
-                where + new Vector2(sunSizeDiagonal, sunSizeDiagonal), Color.Gray);
-            primitiveBatch.AddVertex(
-                where + new Vector2(-sunSizeDiagonal, -sunSizeDiagonal), Color.Gray);
-
-            primitiveBatch.End();
-        }
-
-        #endregion
-
-//        #region Entry point
-//
-//        /// <summary>
-//        /// The main entry point for the application.
-//        /// </summary>
-//        static void Main()
-//        {
-//            using (PrimitivesSampleGame game = new PrimitivesSampleGame())
-//            {
-//                game.Run();
-//            }
-//        }
-//
-//        #endregion
-
-    }
-}
+//-----------------------------------------------------------------------------
+// PrimitivesSampleGame.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Input;
+
+namespace PrimitivesSample
+{
+    // This sample illustrates the use of PrimitiveBatch to draw lines and points
+    // on the screen. Lines and points are used to recreate the Spacewars starter kit's
+    // retro mode.
+    public class PrimitivesSampleGame : Microsoft.Xna.Framework.Game
+    {
+#if ANDROID
+        // Static reference to the Android activity
+        public new static object? Activity;
+#endif
+
+        // this constant controls the number of stars that will be created when the game
+        // starts up.
+        const int NumStars = 500;
+
+        // what percentage of those stars will be "big" stars? the default is 20%.
+        const float PercentBigStars = .2f;
+
+        // how bright will stars be?  somewhere between these two values.
+        const byte MinimumStarBrightness = 56;
+        const byte MaximumStarBrightness = 255;
+
+        // how big is the ship?
+        const float ShipSizeX = 10f;
+        const float ShipSizeY = 15f;
+        const float ShipCutoutSize = 5f;
+
+        // the radius of the sun.
+        const float SunSize = 30f;
+
+
+
+        GraphicsDeviceManager graphics;
+
+        // PrimitiveBatch is the new class introduced in this sample. We'll use it to
+        // draw everything in this sample, including the stars, ships, and sun.
+        PrimitiveBatch primitiveBatch = null!;
+
+        // these two lists, stars, and starColors, keep track of the positions and
+        // colors of all the stars that we will randomly generate during the initialize
+        // phase.
+        List<Vector2> stars = new List<Vector2>();
+        List<Color> starColors = new List<Color>();
+
+
+        public PrimitivesSampleGame()
+        {
+            graphics = new GraphicsDeviceManager(this);
+            Content.RootDirectory = "Content";
+
+            graphics.PreferredBackBufferWidth = 480;
+            graphics.PreferredBackBufferHeight = 800;
+
+            IsMouseVisible = true;
+#if MOBILE
+            graphics.IsFullScreen = true;
+#endif
+        }
+
+        protected override void Initialize()
+        {
+            base.Initialize();
+
+            // CreateStars needs to know how big the GraphicsDevice's viewport is, so 
+            // once base.Initialize has been called, we can call this.
+            CreateStars();
+        }
+
+        private void CreateStars()
+        {
+            // since every star will be put in a random place and have a random color, 
+            // a random number generator might come in handy.
+            Random random = new Random();
+
+            // where can we put the stars?
+            int screenWidth = graphics.GraphicsDevice.Viewport.Width;
+            int screenHeight = graphics.GraphicsDevice.Viewport.Height;
+
+
+            for (int i = 0; i < NumStars; i++)
+            {
+                // pick a random spot...
+                Vector2 where = new Vector2(
+                    random.Next(0, screenWidth),
+                    random.Next(0, screenHeight));
+
+                // ...and a random color. it's safe to cast random.Next to a byte,
+                // because MinimumStarBrightness and MaximumStarBrightness are both
+                // bytes.
+                byte greyValue =
+                    (byte)random.Next(MinimumStarBrightness, MaximumStarBrightness);
+                Color color = new Color(greyValue, greyValue, greyValue);
+
+                // if the random number was greater than the percentage chance for a big
+                // star, this is just a normal star.
+                if ((float)random.NextDouble() > PercentBigStars)
+                {
+                    starColors.Add(color);
+                    stars.Add(where);
+                }
+                else
+                {
+                    // if this star is randomly selected to be a "big" star, we actually
+                    // add four points and colors to stars and starColors. big stars are
+                    // a block of four points, instead of just one point.
+                    for (int j = 0; j < 4; j++)
+                    {
+                        starColors.Add(color);
+                    }
+
+                    stars.Add(where);
+                    stars.Add(where + Vector2.UnitX);
+                    stars.Add(where + Vector2.UnitY);
+                    stars.Add(where + Vector2.One);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Load your graphics content.
+        /// </summary>
+        protected override void LoadContent()
+        {
+            primitiveBatch = new PrimitiveBatch(graphics.GraphicsDevice);
+        }
+
+
+
+        /// <summary>
+        /// Allows the game to run logic such as updating the world,
+        /// checking for collisions, gathering input and playing audio.
+        /// </summary>
+        /// <param name="gameTime">Provides a snapshot of timing values.</param>
+        protected override void Update(GameTime gameTime)
+        {
+            // Allows the game to exit
+            if ((GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
+                || Keyboard.GetState().IsKeyDown(Keys.Escape))
+                this.Exit();
+
+
+            base.Update(gameTime);
+        }
+
+        /// <summary>
+        /// This is called when the game should draw itself.
+        /// </summary>
+        /// <param name="gameTime">Provides a snapshot of timing values.</param>
+        protected override void Draw(GameTime gameTime)
+        {
+            graphics.GraphicsDevice.Clear(Color.Black);
+
+            // how big is the screen? we'll use that information to center the sun
+            // and place the ships.
+            int screenWidth = graphics.GraphicsDevice.Viewport.Width;
+            int screenHeight = graphics.GraphicsDevice.Viewport.Height;
+
+            // draw the sun in the center
+            DrawSun(new Vector2(screenWidth / 2, screenHeight / 2));
+
+            // draw the left hand ship
+            DrawShip(new Vector2(100, screenHeight / 2));
+
+            // and the right hand ship
+            DrawShip(new Vector2(screenWidth - 100, screenHeight / 2));
+
+            DrawStars();
+
+            base.Draw(gameTime);
+        }
+
+        // DrawStars is called to do exactly what its name says: draw the stars.
+        private void DrawStars()
+        {
+            // stars are drawn as a list of points, so begin the primitiveBatch.
+            primitiveBatch.Begin(PrimitiveType.TriangleList);
+
+            // loop through all of the stars, and tell primitive batch to draw them.
+            // each star is a very small triangle.
+            for (int i = 0; i < stars.Count; i++)
+            {
+                primitiveBatch.AddVertex(stars[i], starColors[i]);
+                primitiveBatch.AddVertex(stars[i] + Vector2.UnitX, starColors[i]);
+                primitiveBatch.AddVertex(stars[i] + Vector2.UnitY, starColors[i]);
+            }
+
+            // and then tell it that we're done.
+            primitiveBatch.End();
+        }
+
+        // called to draw the spacewars ship at a point on the screen.
+        private void DrawShip(Vector2 where)
+        {
+            // tell the primitive batch to start drawing lines
+            primitiveBatch.Begin(PrimitiveType.LineList);
+
+            // from the nose, down the left hand side
+            primitiveBatch.AddVertex(
+                where + new Vector2(0f, -ShipSizeY), Color.White);
+            primitiveBatch.AddVertex(
+                where + new Vector2(-ShipSizeX, ShipSizeY), Color.White);
+
+            // to the right and up, into the cutout
+            primitiveBatch.AddVertex(
+                where + new Vector2(-ShipSizeX, ShipSizeY), Color.White);
+            primitiveBatch.AddVertex(
+                where + new Vector2(0f, ShipSizeY - ShipCutoutSize), Color.White);
+
+            // to the right and down, out of the cutout
+            primitiveBatch.AddVertex(
+                where + new Vector2(0f, ShipSizeY - ShipCutoutSize), Color.White);
+            primitiveBatch.AddVertex(
+                where + new Vector2(ShipSizeX, ShipSizeY), Color.White);
+
+            // and back up to the nose, where we started.
+            primitiveBatch.AddVertex(
+                where + new Vector2(ShipSizeX, ShipSizeY), Color.White);
+            primitiveBatch.AddVertex(
+                where + new Vector2(0f, -ShipSizeY), Color.White);
+
+            // and we're done.
+            primitiveBatch.End();
+        }
+
+        // called to draw the spacewars sun.
+        private void DrawSun(Vector2 where)
+        {
+            // the sun is made from 4 lines in a circle.
+            primitiveBatch.Begin(PrimitiveType.LineList);
+
+            // draw the vertical and horizontal lines
+            primitiveBatch.AddVertex(where + new Vector2(0, SunSize), Color.White);
+            primitiveBatch.AddVertex(where + new Vector2(0, -SunSize), Color.White);
+
+            primitiveBatch.AddVertex(where + new Vector2(SunSize, 0), Color.White);
+            primitiveBatch.AddVertex(where + new Vector2(-SunSize, 0), Color.White);
+
+            // to know where to draw the diagonal lines, we need to use trig.
+            // cosine of pi / 4 tells us what the x coordinate of a circle's radius is
+            // at 45 degrees. the y coordinate normally would come from sin, but sin and
+            // cos 45 are the same, so we can reuse cos for both x and y.
+            float sunSizeDiagonal = (float)Math.Cos(MathHelper.PiOver4);
+
+            // since that trig tells us the x and y for a unit circle, which has a
+            // radius of 1, we need scale that result by the sun's radius.
+            sunSizeDiagonal *= SunSize;
+
+            primitiveBatch.AddVertex(
+                where + new Vector2(-sunSizeDiagonal, sunSizeDiagonal), Color.Gray);
+            primitiveBatch.AddVertex(
+                where + new Vector2(sunSizeDiagonal, -sunSizeDiagonal), Color.Gray);
+
+            primitiveBatch.AddVertex(
+                where + new Vector2(sunSizeDiagonal, sunSizeDiagonal), Color.Gray);
+            primitiveBatch.AddVertex(
+                where + new Vector2(-sunSizeDiagonal, -sunSizeDiagonal), Color.Gray);
+
+            primitiveBatch.End();
+        }
+
+
+//        #region Entry point
+//
+//        /// <summary>
+//        /// The main entry point for the application.
+//        /// </summary>
+//        static void Main()
+//        {
+//            using (PrimitivesSampleGame game = new PrimitivesSampleGame())
+//            {
+//                game.Run();
+//            }
+//        }
+//
+//        #endregion
+
+    }
+}

+ 0 - 0
Primitives/Properties/AndroidManifest.xml → Primitives/Platforms/Android/AndroidManifest.xml


+ 24 - 0
Primitives/Platforms/Android/MainActivity.cs

@@ -0,0 +1,24 @@
+using System;
+using Android.App;
+using Android.Content.PM;
+using Android.OS;
+using Android.Views;
+using Microsoft.Xna.Framework;
+
+namespace PrimitivesSample.Android
+{
+    [Activity(Label = "Primitives Sample",
+              MainLauncher = true,
+              ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden,
+              ScreenOrientation = ScreenOrientation.Landscape)]
+    public class MainActivity : AndroidGameActivity
+    {
+        protected override void OnCreate(Bundle? bundle)
+        {
+            base.OnCreate(bundle);
+            var game = new PrimitivesSampleGame();
+            SetContentView((View)game.Services.GetService(typeof(View))!);
+            game.Run();
+        }
+    }
+}

+ 24 - 0
Primitives/Platforms/Android/Primitives.Android.csproj

@@ -0,0 +1,24 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFramework>net8.0-android</TargetFramework>
+    <OutputType>Exe</OutputType>
+    <Nullable>enable</Nullable>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <UseAndroid>true</UseAndroid>
+    <AssemblyName>Primitives.Android</AssemblyName>
+    <RootNamespace>PrimitivesSample</RootNamespace>
+    <ApplicationId>com.primitives.sample</ApplicationId>
+    <ApplicationVersion>1</ApplicationVersion>
+    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
+  </PropertyGroup>
+  <ItemGroup>
+    <PackageReference Include="MonoGame.Framework.Android" Version="3.8.*" />
+    <ProjectReference Include="..\..\Core\Primitives.Core.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="..\..\Core\Content\**\*.xnb" Link="Content\%(RecursiveDir)%(Filename)%(Extension)">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+</Project>

+ 0 - 0
Primitives/Resources/AboutResources.txt → Primitives/Platforms/Android/Resources/AboutResources.txt


+ 0 - 0
Primitives/Resources/Resource.designer.cs → Primitives/Platforms/Android/Resources/Resource.designer.cs


+ 0 - 0
Primitives/Resources/drawable/Icon.png → Primitives/Platforms/Android/Resources/drawable/Icon.png


+ 0 - 0
Primitives/Resources/layout/Main.axml → Primitives/Platforms/Android/Resources/layout/Main.axml


+ 0 - 0
Primitives/Resources/values/Strings.xml → Primitives/Platforms/Android/Resources/values/Strings.xml


+ 28 - 0
Primitives/Platforms/Desktop/Primitives.DesktopGL.csproj

@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.0</TargetFramework>
+    <AssemblyName>Primitives.DesktopGL</AssemblyName>
+    <RootNamespace>PrimitivesSample</RootNamespace>
+    <ApplicationIcon>..\..\Core\Content\Game.ico</ApplicationIcon>
+    <AssemblyTitle>MonoGame.Samples.Primitives.DesktopGL</AssemblyTitle>
+    <AssemblyDescription></AssemblyDescription>
+    <AssemblyConfiguration></AssemblyConfiguration>
+    <AssemblyCompany>Savage Software Solutions Ltd.</AssemblyCompany>
+    <AssemblyProduct></AssemblyProduct>
+    <AssemblyCopyright>Savage Software Solutions Ltd.</AssemblyCopyright>
+    <AssemblyTrademark></AssemblyTrademark>
+    <AssemblyCulture></AssemblyCulture>
+    <AssemblyVersion>1.0</AssemblyVersion>
+  </PropertyGroup>
+  <ItemGroup>
+    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.*" />
+    <ProjectReference Include="..\..\Core\Primitives.Core.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="..\..\Core\Content\**\*.xnb" Link="Content\%(RecursiveDir)%(Filename)%(Extension)">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+</Project>

+ 14 - 0
Primitives/Platforms/Desktop/Program.cs

@@ -0,0 +1,14 @@
+using System;
+
+namespace PrimitivesSample.Desktop
+{
+    public static class Program
+    {
+        [STAThread]
+        static void Main()
+        {
+            using (var game = new PrimitivesSampleGame())
+                game.Run();
+        }
+    }
+}

+ 30 - 0
Primitives/Platforms/Windows/Primitives.Windows.csproj

@@ -0,0 +1,30 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.0-windows</TargetFramework>
+    <UseWindowsForms>true</UseWindowsForms>
+    <AssemblyName>Primitives.Windows</AssemblyName>
+    <RootNamespace>PrimitivesSample</RootNamespace>
+    <ApplicationIcon>..\..\Core\Content\Game.ico</ApplicationIcon>
+    <AssemblyTitle>MonoGame.Samples.Primitives.Windows</AssemblyTitle>
+    <AssemblyDescription></AssemblyDescription>
+    <AssemblyConfiguration></AssemblyConfiguration>
+    <AssemblyCompany>Savage Software Solutions Ltd.</AssemblyCompany>
+    <AssemblyProduct></AssemblyProduct>
+    <AssemblyCopyright>Savage Software Solutions Ltd.</AssemblyCopyright>
+    <AssemblyTrademark></AssemblyTrademark>
+    <AssemblyCulture></AssemblyCulture>
+    <AssemblyVersion>1.0</AssemblyVersion>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="MonoGame.Framework.WindowsDX" Version="3.8.*" />
+    <ProjectReference Include="..\..\Core\Primitives.Core.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="..\..\Core\Content\**\*.xnb" Link="Content\%(RecursiveDir)%(Filename)%(Extension)">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+</Project>

+ 15 - 0
Primitives/Platforms/Windows/Program.cs

@@ -0,0 +1,15 @@
+using System;
+using PrimitivesSample;
+
+namespace PrimitivesSample.Windows
+{
+    public static class Program
+    {
+        [STAThread]
+        static void Main()
+        {
+            using (var game = new PrimitivesSampleGame())
+                game.Run();
+        }
+    }
+}

+ 19 - 0
Primitives/Platforms/iOS/AppDelegate.cs

@@ -0,0 +1,19 @@
+using Foundation;
+using UIKit;
+using Microsoft.Xna.Framework;
+
+namespace PrimitivesSample.iOS
+{
+    [Register("AppDelegate")]
+    public class AppDelegate : UIApplicationDelegate
+    {
+        Game? game;
+
+        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
+        {
+            game = new PrimitivesSampleGame();
+            game.Run();
+            return true;
+        }
+    }
+}

+ 0 - 0
Primitives/Info.plist → Primitives/Platforms/iOS/Info.plist


+ 22 - 0
Primitives/Platforms/iOS/Primitives.iOS.csproj

@@ -0,0 +1,22 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFramework>net8.0-ios</TargetFramework>
+    <OutputType>Exe</OutputType>
+    <Nullable>enable</Nullable>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <AssemblyName>Primitives.iOS</AssemblyName>
+    <RootNamespace>PrimitivesSample</RootNamespace>
+    <SupportedOSPlatformVersion>11.0</SupportedOSPlatformVersion>
+  </PropertyGroup>
+  
+  <ItemGroup>
+    <PackageReference Include="MonoGame.Framework.iOS" Version="3.8.*" />
+    <ProjectReference Include="..\..\Core\Primitives.Core.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="..\..\Core\Content\**\*.xnb" Link="Content\%(RecursiveDir)%(Filename)%(Extension)">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+</Project>

+ 13 - 0
Primitives/Platforms/iOS/Program.cs

@@ -0,0 +1,13 @@
+using UIKit;
+
+namespace PrimitivesSample.iOS
+{
+    public class Application
+    {
+        // This is the main entry point of the application.
+        static void Main(string[] args)
+        {
+            UIApplication.Main(args, null, typeof(AppDelegate));
+        }
+    }
+}

+ 0 - 77
Primitives/Primitives.Android.csproj

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{167741E2-2D8E-474A-8D06-9ACB55F0BA83}</ProjectGuid>
-    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <OutputType>Library</OutputType>
-    <RootNamespace>MonoGame.Samples.Primitives.Android</RootNamespace>
-    <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
-    <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
-    <AndroidResgenClass>Resource</AndroidResgenClass>
-    <AndroidApplication>True</AndroidApplication>
-    <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
-    <AssemblyName>MonoGame.Samples.Primitives.Android</AssemblyName>
-    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;ANDROID</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <AndroidLinkMode>None</AndroidLinkMode>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
-    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
-    <DefineConstants>ANDROID</DefineConstants>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="Mono.Android" />
-    <Reference Include="OpenTK" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Activity1.cs" />
-    <Compile Include="Resources\Resource.designer.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="PrimitiveBatch.cs" />
-    <Compile Include="PrimitivesSampleGame.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\AboutResources.txt" />
-    <None Include="Assets\AboutAssets.txt" />
-    <None Include="Properties\AndroidManifest.xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <AndroidResource Include="Resources\layout\Main.axml" />
-    <AndroidResource Include="Resources\values\Strings.xml" />
-    <AndroidResource Include="Resources\drawable\Icon.png" />
-  </ItemGroup>
-  <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
-  <ItemGroup>
-    <ProjectReference Include="..\..\MonoGame.Framework\MonoGame.Framework.Android.csproj">
-      <Project>{BA9476CF-99BA-4D03-92F2-73D2C5E58883}</Project>
-      <Name>MonoGame.Framework.Android</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\ThirdParty\Lidgren.Network\Lidgren.Network.Android.csproj">
-      <Project>{565129E0-4EE5-4F6F-B403-C3484C9740BE}</Project>
-      <Name>Lidgren.Network.Android</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>

+ 0 - 73
Primitives/Primitives.MacOS.csproj

@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{2DDBFED4-9955-4F02-9937-B9AE82836329}</ProjectGuid>
-    <ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>Primitives</RootNamespace>
-    <AssemblyName>Primitives</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>False</ConsolePause>
-    <EnableCodeSigning>False</EnableCodeSigning>
-    <CreatePackage>False</CreatePackage>
-    <EnablePackageSigning>False</EnablePackageSigning>
-    <IncludeMonoRuntime>False</IncludeMonoRuntime>
-    <UseSGen>False</UseSGen>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="MonoMac" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Info.plist">
-    </None>
-    <None Include="Game.ico" />
-    <None Include="GameThumbnail.png" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
-  <ItemGroup>
-    <Compile Include="PrimitiveBatch.cs" />
-    <Compile Include="PrimitivesSampleGame.cs" />
-    <Compile Include="Program.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
-      <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
-      <Name>MonoGame.Framework.MacOS</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj">
-      <Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
-      <Name>Lidgren.Network.MacOS</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>

+ 116 - 0
Primitives/Primitives.sln

@@ -0,0 +1,116 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.2.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{FBF56CC3-7AE6-AD2D-3F14-7F97FD322CD6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Primitives.Core", "Core\Primitives.Core.csproj", "{1665461A-9C34-4AED-A199-D6318A6923AE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platforms", "Platforms", "{324791A1-5798-203D-0CA6-A8E0DAEC81C8}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windows", "Windows", "{E4D925BB-EB21-135E-07FA-7558DA769730}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Primitives.Windows", "Platforms\Windows\Primitives.Windows.csproj", "{DB835D9D-C55E-4471-9151-4C53F5736EFE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Desktop", "Desktop", "{5A24DBFA-C605-72AB-2DAB-0CDF0C553B09}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Primitives.DesktopGL", "Platforms\Desktop\Primitives.DesktopGL.csproj", "{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Android", "Android", "{C12F4581-1215-E9D3-7920-679DE6ABBC05}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Primitives.Android", "Platforms\Android\Primitives.Android.csproj", "{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "iOS", "iOS", "{3260BC3A-D039-20BF-4861-22673C64F5D4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Primitives.iOS", "Platforms\iOS\Primitives.iOS.csproj", "{C5EA2FDC-0243-4467-B494-872C9832EB62}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Debug|x64.Build.0 = Debug|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Debug|x86.Build.0 = Debug|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Release|x64.ActiveCfg = Release|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Release|x64.Build.0 = Release|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Release|x86.ActiveCfg = Release|Any CPU
+		{1665461A-9C34-4AED-A199-D6318A6923AE}.Release|x86.Build.0 = Release|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Debug|x64.Build.0 = Debug|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Debug|x86.Build.0 = Debug|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Release|x64.ActiveCfg = Release|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Release|x64.Build.0 = Release|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Release|x86.ActiveCfg = Release|Any CPU
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE}.Release|x86.Build.0 = Release|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Debug|x64.Build.0 = Debug|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Debug|x86.Build.0 = Debug|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Release|x64.ActiveCfg = Release|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Release|x64.Build.0 = Release|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Release|x86.ActiveCfg = Release|Any CPU
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB}.Release|x86.Build.0 = Release|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Debug|x64.Build.0 = Debug|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Debug|x86.Build.0 = Debug|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Release|x64.ActiveCfg = Release|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Release|x64.Build.0 = Release|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Release|x86.ActiveCfg = Release|Any CPU
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3}.Release|x86.Build.0 = Release|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Debug|x64.Build.0 = Debug|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Debug|x86.Build.0 = Debug|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Release|x64.ActiveCfg = Release|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Release|x64.Build.0 = Release|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Release|x86.ActiveCfg = Release|Any CPU
+		{C5EA2FDC-0243-4467-B494-872C9832EB62}.Release|x86.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{1665461A-9C34-4AED-A199-D6318A6923AE} = {FBF56CC3-7AE6-AD2D-3F14-7F97FD322CD6}
+		{E4D925BB-EB21-135E-07FA-7558DA769730} = {324791A1-5798-203D-0CA6-A8E0DAEC81C8}
+		{DB835D9D-C55E-4471-9151-4C53F5736EFE} = {E4D925BB-EB21-135E-07FA-7558DA769730}
+		{5A24DBFA-C605-72AB-2DAB-0CDF0C553B09} = {324791A1-5798-203D-0CA6-A8E0DAEC81C8}
+		{3E281A7D-EBF3-4AF1-A1D4-DA67B3DE79FB} = {5A24DBFA-C605-72AB-2DAB-0CDF0C553B09}
+		{C12F4581-1215-E9D3-7920-679DE6ABBC05} = {324791A1-5798-203D-0CA6-A8E0DAEC81C8}
+		{6C13AD54-ECE2-4A0D-BD33-310F99B316C3} = {C12F4581-1215-E9D3-7920-679DE6ABBC05}
+		{3260BC3A-D039-20BF-4861-22673C64F5D4} = {324791A1-5798-203D-0CA6-A8E0DAEC81C8}
+		{C5EA2FDC-0243-4467-B494-872C9832EB62} = {3260BC3A-D039-20BF-4861-22673C64F5D4}
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {63CC87A7-A9D0-43DC-B4A7-C3DCC8CDCD25}
+	EndGlobalSection
+EndGlobal

+ 0 - 42
Primitives/Program.cs

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

+ 0 - 30
Primitives/Properties/AssemblyInfo.cs

@@ -1,30 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using Android.App;
-
-// Information about this assembly is defined by the following attributes. 
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("MonoGame.Samples.Primitives.Android")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Savage Software Solutions Ltd.")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("Savage Software Solutions Ltd.")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly, 
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
-// This app uses the internet, this can be removed if not needed
-[assembly: UsesPermission("android.permission.INTERNET")]

+ 180 - 0
Primitives/README.md

@@ -0,0 +1,180 @@
+# Primitives Sample - MonoGame 3.8.*
+
+This sample demonstrates how to use the `PrimitiveBatch` class to draw lines and points on screen using MonoGame. The sample recreates a retro-style space scene with stars, spaceships, and a sun, all drawn using primitive shapes.
+
+## Features
+
+- Drawing lines and points using `PrimitiveBatch`
+- Dynamic star field generation
+- Simple spaceship and sun rendering using line primitives
+- Cross-platform support for Windows, DesktopGL, Android, and iOS
+
+
+## New Project Structure
+
+```
+/Core
+  Primitives.Core.csproj         # Shared game logic and rendering code
+  PrimitivesSampleGame.cs
+  PrimitiveBatch.cs
+
+/Platforms/Windows
+  Primitives.Windows.csproj      # Windows DirectX entry point
+  Program.cs
+
+/Platforms/Desktop
+  Primitives.DesktopGL.csproj    # Cross-platform OpenGL entry point
+  Program.cs
+
+/Platforms/Android
+  Primitives.Android.csproj      # Android entry point
+  MainActivity.cs
+
+/Platforms/iOS
+  Primitives.iOS.csproj          # iOS entry point
+  Program.cs
+  AppDelegate.cs
+```
+
+All platform projects reference `/Core/Primitives.Core.csproj` for shared code. Platform-specific code and entry points are isolated in their respective directories, reducing the need for `#if` blocks.
+
+All projects use modern .NET SDK-style project files and target .NET 8.0 with MonoGame 3.8.* NuGet packages.
+
+## What's New in This Modernization
+
+This project has been updated from the original MonoGame samples to use modern development practices:
+
+- **SDK-style projects**: All `.csproj` files use the modern SDK format
+- **NuGet packages**: Uses MonoGame 3.8.* NuGet packages instead of source references
+- **.NET 8.0**: Targets the latest .NET 8.0 framework for each platform
+- **Removed legacy platforms**: MacOS (classic) and other deprecated platforms removed
+- **VS Code support**: Full debugging and build task support for VS Code
+- **Modern Android**: Updated to use modern Android development practices
+- **Cross-platform**: Builds on Windows, with Android and iOS support
+
+## Prerequisites
+
+- .NET 8.0 or later
+- MonoGame 3.8.* (installed via NuGet)
+- For Android development: Android SDK
+- For iOS development: Xcode (macOS only)
+
+## Building and Running
+
+### Using Visual Studio
+
+1. Open `Primitives.sln` in Visual Studio
+2. Set your desired platform project as the startup project
+3. Build and run (F5)
+
+### Using Visual Studio Code
+
+1. Open the folder in VS Code
+2. Use Ctrl+Shift+P and run "Tasks: Run Task"
+3. Select one of the available tasks:
+   - `build-windows` - Build Windows version
+   - `build-desktopgl` - Build DesktopGL version
+   - `build-android` - Build Android version
+   - `build-all` - Build all projects
+   - `run-windows` - Build and run Windows version
+   - `run-desktopgl` - Build and run DesktopGL version
+   - `clean` - Clean all build artifacts
+   - `restore` - Restore NuGet packages
+
+Alternatively, use F5 to debug the Windows or DesktopGL versions.
+
+### Using Command Line
+
+#### Windows/DesktopGL
+```bash
+# Build all projects
+dotnet build Primitives.sln
+
+# Build specific platform
+dotnet build Primitives.Windows.csproj
+dotnet build Primitives.DesktopGL.csproj
+
+# Run Windows version
+dotnet run --project Primitives.Windows.csproj
+
+# Run DesktopGL version
+dotnet run --project Primitives.DesktopGL.csproj
+```
+
+#### Android
+```bash
+# Build Android version
+dotnet build Primitives.Android.csproj
+
+# To deploy to device/emulator, use:
+dotnet build Primitives.Android.csproj -t:Run
+```
+
+#### iOS (macOS only)
+```bash
+# Build iOS version
+dotnet build Primitives.iOS.csproj
+```
+
+## Platform-Specific Notes
+
+### Windows
+- Uses DirectX for rendering
+- Requires Windows with .NET 8.0
+
+### DesktopGL
+- Uses OpenGL for rendering
+- Cross-platform (Windows, Linux, macOS)
+- Best choice for cross-platform desktop development
+
+### Android
+- Minimum API level: 21 (Android 5.0)
+- Target API level: 34 (Android 14)
+- Requires Android SDK for building
+
+### iOS
+- Minimum iOS version: 11.0
+- Requires macOS with Xcode for building
+- Requires Apple Developer account for device deployment
+
+## Code Overview
+
+The main classes in this sample:
+
+- **PrimitivesSampleGame** - Main game class that inherits from `Game`
+- **PrimitiveBatch** - Utility class for drawing lines and points efficiently
+- **Activity1** (Android) - Android activity entry point
+- **AppDelegate** (iOS) - iOS application delegate
+
+## Learning Points
+
+1. **PrimitiveBatch Usage** - Learn how to efficiently draw lines and points
+2. **Cross-Platform Development** - See how MonoGame enables multi-platform deployment
+3. **Resource Management** - Understand how to manage graphics resources
+4. **Game Loop** - Basic game update and draw cycle implementation
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Build Errors**: Ensure you have .NET 8.0 installed
+2. **Missing MonoGame**: The NuGet packages should restore automatically
+3. **Android Build Issues**: Verify Android SDK is properly configured
+4. **iOS Build Issues**: Ensure Xcode is installed (macOS only)
+
+### Platform-Specific Issues
+
+- **Windows**: Ensure you have the latest Visual C++ redistributables
+- **DesktopGL**: OpenGL drivers must be up to date
+- **Android**: Enable Developer Options and USB Debugging on device
+- **iOS**: Valid provisioning profile required for device deployment
+
+## Additional Resources
+
+- [MonoGame Documentation](https://docs.monogame.net/)
+- [MonoGame Community](https://community.monogame.net/)
+- [MonoGame GitHub](https://github.com/MonoGame/MonoGame)
+
+## License
+
+This sample is part of the MonoGame Samples collection and follows the same license terms.