mirror of
https://github.com/prime31/FNA-VSCode-Template.git
synced 2025-10-31 21:50:44 +07:00
dotnet core jank
This commit is contained in:
parent
c3e9e7cf80
commit
5317c2745d
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
@ -4,7 +4,23 @@
|
||||
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Launch (dotnet)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "Build (Debug)",
|
||||
"program": "${workspaceFolder}/project_name/bin/Debug/project_name.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/project_name",
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false,
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"osx":{
|
||||
"env": {
|
||||
"DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Launch (Mac)",
|
||||
"type": "mono",
|
||||
|
||||
13
.vscode/tasks.json
vendored
13
.vscode/tasks.json
vendored
@ -1,6 +1,19 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "dotnet Build and Run (Debug)",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"osx":{
|
||||
"command": "dotnet ${workspaceFolder}/project_name/bin/Debug/project_name.dll",
|
||||
"env": {
|
||||
"DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/"
|
||||
},
|
||||
},
|
||||
"dependsOn": "Build (Debug)",
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "Restore Project",
|
||||
"type": "shell",
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Nez;
|
||||
using Nez.ImGuiTools;
|
||||
|
||||
@ -18,7 +21,7 @@ namespace project_name
|
||||
Scene = new DefaultScene();
|
||||
|
||||
#if DEBUG
|
||||
System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out));
|
||||
// System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out));
|
||||
|
||||
// optionally render Nez in an ImGui window
|
||||
var imGuiManager = new ImGuiManager();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace project_name
|
||||
{
|
||||
@ -22,6 +22,8 @@ namespace project_name
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
NativeLibrary.SetDllImportResolver(typeof(Microsoft.Xna.Framework.Color).Assembly, ImportResolver);
|
||||
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
try
|
||||
@ -47,5 +49,34 @@ namespace project_name
|
||||
game.Run();
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr ImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||
{
|
||||
IntPtr libHandle = IntPtr.Zero;
|
||||
if (libraryName == "FNA3D")
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
NativeLibrary.TryLoad("bin/Debug/x64/FNA3D.dll", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
NativeLibrary.TryLoad("bin/Debug/osx/libFNA3D.0.dylib", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
NativeLibrary.TryLoad("bin/Debug/lib64/libFNA3D.so.0", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
}
|
||||
else if (libraryName == "SDL2")
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
NativeLibrary.TryLoad("bin/Debug/x64/SDL2.dll", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
NativeLibrary.TryLoad("bin/Debug/osx/libSDL2-2.0.0.dylib", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
NativeLibrary.TryLoad("bin/Debug/lib64/libSDL2-2.0.0.so.0", assembly, DllImportSearchPath.System32, out libHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"----- no case for library load: {libraryName} ---------");
|
||||
}
|
||||
Console.WriteLine($"----- no case for library load: {libHandle} ---------");
|
||||
return libHandle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<AssemblyName>project_name</AssemblyName>
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
<!-- Reference FNA, Nez, ImGui and Persistence projects. Optionally add a Farseer reference here and in the .sln file -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../FNA/FNA.csproj"/>
|
||||
<ProjectReference Include="../Nez/Nez.Portable/Nez.FNA.csproj"/>
|
||||
<ProjectReference Include="../FNA/FNA.Core.csproj"/>
|
||||
<ProjectReference Include="../Nez/Nez.Portable/Nez.FNA.Standard.csproj"/>
|
||||
<ProjectReference Include="../Nez/Nez.Persistence/Nez.FNA.Persistence.csproj" />
|
||||
<ProjectReference Include="../Nez/Nez.ImGui/Nez.FNA.ImGui.csproj"/>
|
||||
<!-- <ProjectReference Include="../Nez/Nez.FarseerPhysics/Nez.FNA.FarseerPhysics.csproj" /> -->
|
||||
@ -51,12 +51,13 @@
|
||||
<None Remove="CompiledContent\.*"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- MonoGames content pipeline needs this defined -->
|
||||
<!-- optional: MonoGame's content pipeline needs this defined
|
||||
<ItemGroup>
|
||||
<MonoGameContentReference Include="CompiledContent\Content.mgcb"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="../MonoGameContent.targets"/>
|
||||
-->
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user