update to latest MoonWorks
parent
75e525c71a
commit
ce4b03aca4
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetName>ProjectName</TargetName>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
|
||||
|
@ -16,6 +10,7 @@
|
|||
<AssemblyName>ProjectName</AssemblyName>
|
||||
<RootNamespace>ProjectName</RootNamespace>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon />
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
13
README.md
13
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
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using MoonWorks;
|
||||
using MoonWorks.Window;
|
||||
|
||||
namespace ProjectName
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue