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

40
.vscode/tasks.json vendored
View File

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

View File

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

View File

@ -7,11 +7,6 @@ namespace ProjectName
{ {
class Program 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) static void Main(string[] args)
{ {
WindowCreateInfo windowCreateInfo = new WindowCreateInfo WindowCreateInfo windowCreateInfo = new WindowCreateInfo
@ -19,19 +14,19 @@ namespace ProjectName
WindowWidth = 1280, WindowWidth = 1280,
WindowHeight = 720, WindowHeight = 720,
WindowTitle = "ProjectName", 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 Cap = 60
}; };
ProjectNameGame game = new ProjectNameGame( ProjectNameGame game = new ProjectNameGame(
windowCreateInfo, windowCreateInfo,
MoonWorks.Graphics.PresentMode.FIFORelaxed, frameLimiterSettings,
framerateSettings,
true true
); );

View File

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