diff --git a/.vscode/launch.json b/.vscode/launch.json index 3c21acb..933c3d4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,13 +2,13 @@ "version": "0.2.0", "configurations": [ { - "name": "Attach to .NET 5 Debugger", + "name": "Attach to .NET 6 Debugger", "type": "coreclr", "request": "launch", - "preLaunchTask": "Build: .NET 5 Debug", - "program": "${workspaceFolder}/bin/x64/Debug/net5.0/ProjectName.dll", + "preLaunchTask": "Build: .NET 6 Debug", + "program": "${workspaceFolder}/bin/x64/Debug/net6.0/ProjectName.dll", "args": [], - "cwd": "${workspaceFolder}/bin/x64/Debug/net5.0", + "cwd": "${workspaceFolder}/bin/x64/Debug/net6.0", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5f699b7..662e623 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -21,12 +21,12 @@ }, "tasks": [ { - "label": "Build & Run: .NET 5 Debug", + "label": "Build & Run: .NET 6 Debug", "type": "shell", "dependsOrder": "sequence", "dependsOn": [ - "Build: .NET 5 Debug", - "Run: .NET 5 Debug" + "Build: .NET 6 Debug", + "Run: .NET 6 Debug" ], "group": { "kind": "build", @@ -35,7 +35,7 @@ "problemMatcher": [] }, { - "label": "Build: .NET 5 Debug", + "label": "Build: .NET 6 Debug", "command": "dotnet", "args": [ "build", @@ -51,17 +51,13 @@ "problemMatcher": [] }, { - "label": "Run: .NET 5 Debug", + "label": "Run: .NET 6 Debug", "command": "dotnet", "args": [ "./ProjectName.dll" ], "options": { - "env": { - "LD_LIBRARY_PATH": "./lib64", - "DYLD_LIBRARY_PATH": "./osx" - }, - "cwd": "${workspaceFolder}/bin/x64/Debug/net5.0" + "cwd": "${workspaceFolder}/bin/x64/Debug/net6.0" }, "type": "process", "group": { @@ -71,7 +67,7 @@ "problemMatcher": [] }, { - "label": "Build: .NET 5 Release", + "label": "Build: .NET 6 Release", "command": "dotnet", "args": [ "build", @@ -95,11 +91,7 @@ "./ProjectName.dll" ], "options": { - "env": { - "LD_LIBRARY_PATH": "./lib64", - "DYLD_LIBRARY_PATH": "./osx" - }, - "cwd": "${workspaceFolder}/bin/x64/Release/net5.0" + "cwd": "${workspaceFolder}/bin/x64/Release/net6.0" }, "type": "process", "group": { @@ -109,11 +101,11 @@ "problemMatcher": [] }, { - "label": "Build & Run: .NET 5 Release", + "label": "Build & Run: .NET 6 Release", "dependsOrder": "sequence", "dependsOn": [ - "Build: .NET 5 Release", - "Run: .NET 5 Release" + "Build: .NET 6 Release", + "Run: .NET 6 Release" ], "type": "shell", "group": { diff --git a/ProjectName.csproj b/ProjectName.csproj index 2d6b182..7407171 100644 --- a/ProjectName.csproj +++ b/ProjectName.csproj @@ -1,13 +1,7 @@ Exe - net5.0 - true - - - - Exe - net5.0 + net6.0 ProjectName false false @@ -16,6 +10,7 @@ ProjectName ProjectName true + true diff --git a/README.md b/README.md index 8c3613c..51a455a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MoonWorksTemplate -Template and build tasks for developing a cross-platform multi-target .NET Framework, Mono, and .NET 5 MoonWorks project in VSCode. +Template and build tasks for developing a cross-platform multi-target .NET 6 MoonWorks project in VSCode. The generated solution file will also work in regular Visual Studio. @@ -8,15 +8,14 @@ NOTE: OSX is broken right now because I need to set up MoltenVK. ## Features -- Includes project boilerplate code -- Build tasks for both .NET Framework, Mono, and .NET 5 side by side +- Project boilerplate code +- VSCode build tasks - VSCode debugger integration ## Requirements - [Git](https://git-scm.com/) or [Git for Windows](https://gitforwindows.org/) on Windows -- [.NET 5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0) -- [.NET Framework 4.7.2 Developer Pack](https://dotnet.microsoft.com/download/dotnet-framework/net472) on Windows +- [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) - [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) on Windows - [Mono](https://www.mono-project.com/) on OSX or Linux - [Visual Studio Code](https://code.visualstudio.com/) @@ -35,9 +34,7 @@ NOTE: OSX is broken right now because I need to set up MoltenVK. - Open the project directory in VSCode - Press Ctrl-Shift-B to open the build tasks menu -- `Framework` tasks use .NET Framework to build and run (Windows only) -- `Mono` tasks use Mono to build and run -- `.NET 5` tasks use .NET 5 to build and run +- Tasks use .NET 6.0 to build and run - Press F5 to build and debug ## Acknowledgments diff --git a/src/Graphics/Containers/Framebuffers.cs b/src/Graphics/Containers/Framebuffers.cs deleted file mode 100644 index 17d21b3..0000000 --- a/src/Graphics/Containers/Framebuffers.cs +++ /dev/null @@ -1,26 +0,0 @@ -using MoonWorks.Graphics; - -namespace ProjectName.Graphics -{ - public class Framebuffers - { - public Framebuffer ExampleFramebuffer { get; } - - public Framebuffers( - GraphicsDevice graphicsDevice, - RenderPasses renderPasses, - RenderTargets renderTargets, - uint renderDimensionsX, - uint renderDimensionsY - ) { - ExampleFramebuffer = new Framebuffer( - graphicsDevice, - renderDimensionsX, - renderDimensionsY, - renderPasses.ExampleRenderPass, - null, - renderTargets.ExampleRenderTarget - ); - } - } -} \ No newline at end of file diff --git a/src/Graphics/Containers/RenderPasses.cs b/src/Graphics/Containers/RenderPasses.cs deleted file mode 100644 index 0b7e749..0000000 --- a/src/Graphics/Containers/RenderPasses.cs +++ /dev/null @@ -1,24 +0,0 @@ -using MoonWorks.Graphics; - -namespace ProjectName.Graphics -{ - public class RenderPasses - { - public RenderPass ExampleRenderPass { get; } - public RenderPasses(GraphicsDevice graphicsDevice) - { - var clearPassDescription = new ColorTargetDescription - { - Format = TextureFormat.R8G8B8A8, - LoadOp = LoadOp.Clear, - StoreOp = StoreOp.Store, - MultisampleCount = SampleCount.One - }; - - ExampleRenderPass = new RenderPass( - graphicsDevice, - clearPassDescription - ); - } - } -} \ No newline at end of file diff --git a/src/Graphics/Containers/RenderTargets.cs b/src/Graphics/Containers/RenderTargets.cs deleted file mode 100644 index 5eee4c6..0000000 --- a/src/Graphics/Containers/RenderTargets.cs +++ /dev/null @@ -1,23 +0,0 @@ -using MoonWorks.Graphics; - -namespace ProjectName.Graphics -{ - public class RenderTargets - { - public RenderTarget ExampleRenderTarget { get; } - - public RenderTargets( - GraphicsDevice graphicsDevice, - uint renderDimensionsX, - uint renderDimensionsY - ) { - ExampleRenderTarget = RenderTarget.CreateBackedRenderTarget( - graphicsDevice, - renderDimensionsX, - renderDimensionsY, - TextureFormat.R8G8B8A8, - false - ); - } - } -} diff --git a/src/Graphics/GraphicsObjects.cs b/src/Graphics/GraphicsObjects.cs deleted file mode 100644 index 309e083..0000000 --- a/src/Graphics/GraphicsObjects.cs +++ /dev/null @@ -1,31 +0,0 @@ -using MoonWorks.Graphics; - -namespace ProjectName.Graphics -{ - public class GraphicsObjects - { - public RenderTargets RenderTargets { get; } - public Framebuffers Framebuffers { get; } - public RenderPasses RenderPasses { get; } - - public GraphicsObjects( - GraphicsDevice graphicsDevice, - uint renderDimensionsX, - uint renderDimensionsY - ) { - RenderPasses = new RenderPasses(graphicsDevice); - RenderTargets = new RenderTargets( - graphicsDevice, - renderDimensionsX, - renderDimensionsY - ); - Framebuffers = new Framebuffers( - graphicsDevice, - RenderPasses, - RenderTargets, - renderDimensionsX, - renderDimensionsY - ); - } - } -} diff --git a/src/Program.cs b/src/Program.cs index 1c1a6e6..073db7f 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -2,7 +2,6 @@ using System; using System.IO; using System.Runtime.InteropServices; using MoonWorks; -using MoonWorks.Window; namespace ProjectName { diff --git a/src/ProjectNameGame.cs b/src/ProjectNameGame.cs index 6217f6f..39b3539 100644 --- a/src/ProjectNameGame.cs +++ b/src/ProjectNameGame.cs @@ -1,17 +1,10 @@ using MoonWorks.Graphics; -using MoonWorks.Window; using MoonWorks; -using ProjectName.Graphics; namespace ProjectName { class ProjectNameGame : Game { - private GraphicsObjects GraphicsObjects { get; } - - private int RenderWidth { get; } - private int RenderHeight { get; } - public ProjectNameGame( WindowCreateInfo windowCreateInfo, PresentMode presentMode, @@ -19,13 +12,6 @@ namespace ProjectName ) : base(windowCreateInfo, presentMode, 60, debugMode) { // Insert your game initialization logic here. - GraphicsObjects = new GraphicsObjects( - GraphicsDevice, - windowCreateInfo.WindowWidth, - windowCreateInfo.WindowHeight - ); - RenderWidth = (int)windowCreateInfo.WindowWidth; - RenderHeight = (int)windowCreateInfo.WindowHeight; } protected override void Update(System.TimeSpan dt) @@ -38,29 +24,20 @@ namespace ProjectName // Replace this with your own drawing code. var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); + var swapchainTexture = commandBuffer.AcquireSwapchainTexture(Window); commandBuffer.BeginRenderPass( - GraphicsObjects.RenderPasses.ExampleRenderPass, - GraphicsObjects.Framebuffers.ExampleFramebuffer, - new Rect - { - X = 0, - Y = 0, - W = RenderWidth, - H = RenderHeight - }, - Color.CornflowerBlue.ToVector4() + new ColorAttachmentInfo(swapchainTexture, Color.CornflowerBlue) ); commandBuffer.EndRenderPass(); - commandBuffer.QueuePresent( - GraphicsObjects.RenderTargets.ExampleRenderTarget.TextureSlice, - Filter.Nearest, - Window - ); - GraphicsDevice.Submit(commandBuffer); } + + protected override void OnDestroy() + { + + } } }