update template for .NET 7

main
cosmonaut 2023-06-08 11:07:20 -07:00
parent 4b1a9feda1
commit ad39d7b190
5 changed files with 33 additions and 40 deletions

8
.vscode/launch.json vendored
View File

@ -2,13 +2,13 @@
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET 6 Debugger",
"name": "Attach to .NET 7 Debugger",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "Build: .NET 6 Debug",
"program": "${workspaceFolder}/bin/x64/Debug/net6.0/ProjectName.dll",
"preLaunchTask": "Build: .NET 7 Debug",
"program": "${workspaceFolder}/bin/x64/Debug/net7.0/ProjectName.dll",
"args": [],
"cwd": "${workspaceFolder}/bin/x64/Debug/net6.0",
"cwd": "${workspaceFolder}/bin/x64/Debug/net7.0",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}

40
.vscode/tasks.json vendored
View File

@ -21,12 +21,12 @@
},
"tasks": [
{
"label": "Build & Run: .NET 6 Debug",
"label": "Build & Run: .NET 7 Debug",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": [
"Build: .NET 6 Debug",
"Run: .NET 6 Debug"
"Build: .NET 7 Debug",
"Run: .NET 7 Debug"
],
"group": {
"kind": "build",
@ -35,7 +35,7 @@
"problemMatcher": []
},
{
"label": "Build: .NET 6 Debug",
"label": "Build: .NET 7 Debug",
"command": "dotnet",
"args": [
"build",
@ -51,13 +51,13 @@
"problemMatcher": []
},
{
"label": "Run: .NET 6 Debug",
"command": "dotnet",
"args": [
"./ProjectName.dll"
],
"label": "Run: .NET 7 Debug",
"command": "ProjectName",
"windows": {
"command": "ProjectName.exe"
},
"options": {
"cwd": "${workspaceFolder}/bin/x64/Debug/net6.0"
"cwd": "${workspaceFolder}/bin/x64/Debug/net7.0"
},
"type": "process",
"group": {
@ -67,7 +67,7 @@
"problemMatcher": []
},
{
"label": "Build: .NET 6 Release",
"label": "Build: .NET 7 Release",
"command": "dotnet",
"args": [
"build",
@ -85,13 +85,13 @@
"problemMatcher": []
},
{
"label": "Run: .NET 5 Release",
"command": "dotnet",
"args": [
"./ProjectName.dll"
],
"label": "Run: .NET 7 Release",
"command": "ProjectName",
"windows": {
"command": "ProjectName.exe"
},
"options": {
"cwd": "${workspaceFolder}/bin/x64/Release/net6.0"
"cwd": "${workspaceFolder}/bin/x64/Debug/net7.0"
},
"type": "process",
"group": {
@ -101,11 +101,11 @@
"problemMatcher": []
},
{
"label": "Build & Run: .NET 6 Release",
"label": "Build & Run: .NET 7 Release",
"dependsOrder": "sequence",
"dependsOn": [
"Build: .NET 6 Release",
"Run: .NET 6 Release"
"Build: .NET 7 Release",
"Run: .NET 7 Release"
],
"type": "shell",
"group": {

View File

@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<TargetName>ProjectName</TargetName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<LangVersion>7.3</LangVersion>
<StartupObject>ProjectName.Program</StartupObject>
<AssemblyName>ProjectName</AssemblyName>
<RootNamespace>ProjectName</RootNamespace>

View File

@ -7,11 +7,6 @@ namespace ProjectName
{
class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetDllDirectory(string lpPathName);
static void Main(string[] args)
{
WindowCreateInfo windowCreateInfo = new WindowCreateInfo
@ -19,19 +14,19 @@ namespace ProjectName
WindowWidth = 1280,
WindowHeight = 720,
WindowTitle = "ProjectName",
ScreenMode = ScreenMode.Windowed
ScreenMode = ScreenMode.Windowed,
PresentMode = PresentMode.FIFORelaxed
};
FramerateSettings framerateSettings = new FramerateSettings
FrameLimiterSettings frameLimiterSettings = new FrameLimiterSettings
{
Mode = FramerateMode.Uncapped,
Mode = FrameLimiterMode.Capped,
Cap = 60
};
ProjectNameGame game = new ProjectNameGame(
windowCreateInfo,
MoonWorks.Graphics.PresentMode.FIFORelaxed,
framerateSettings,
frameLimiterSettings,
true
);

View File

@ -7,10 +7,9 @@ namespace ProjectName
{
public ProjectNameGame(
WindowCreateInfo windowCreateInfo,
PresentMode presentMode,
FramerateSettings framerateSettings,
FrameLimiterSettings frameLimiterSettings,
bool debugMode
) : base(windowCreateInfo, presentMode, framerateSettings, 60, debugMode)
) : base(windowCreateInfo, frameLimiterSettings, 60, debugMode)
{
// Insert your game initialization logic here.
}
@ -25,7 +24,7 @@ namespace ProjectName
// Replace this with your own drawing code.
var commandBuffer = GraphicsDevice.AcquireCommandBuffer();
var swapchainTexture = commandBuffer.AcquireSwapchainTexture(Window);
var swapchainTexture = commandBuffer.AcquireSwapchainTexture(MainWindow);
commandBuffer.BeginRenderPass(
new ColorAttachmentInfo(swapchainTexture, Color.CornflowerBlue)