From 64c59fa434a23aa12d7bfee715a282dd0adc6354 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 25 Jan 2022 16:25:44 -0800 Subject: [PATCH] restructure template project generation --- .vscode/launch.json | 26 +- .vscode/tasks.json | 194 +------------ {ProjectName/Content => Content}/README.md | 0 ...pyMoonlibs.targets => CopyMoonlibs.targets | 18 +- ProjectName.Framework.sln | 31 --- ...jectName.Core.csproj => ProjectName.csproj | 26 +- ProjectName.Core.sln => ProjectName.sln | 56 ++-- ProjectName/DllMap.cs | 259 ------------------ ProjectName/ProjectName.Framework.csproj | 34 --- install.sh | 17 +- .../Graphics/Containers/Framebuffers.cs | 0 .../Graphics/Containers/RenderPasses.cs | 0 .../Graphics/Containers/RenderTargets.cs | 0 .../Graphics/GraphicsObjects.cs | 0 {ProjectName => src}/Program.cs | 14 +- {ProjectName => src}/ProjectNameGame.cs | 4 +- 16 files changed, 66 insertions(+), 613 deletions(-) rename {ProjectName/Content => Content}/README.md (100%) rename ProjectName/CopyMoonlibs.targets => CopyMoonlibs.targets (63%) delete mode 100644 ProjectName.Framework.sln rename ProjectName/ProjectName.Core.csproj => ProjectName.csproj (67%) rename ProjectName.Core.sln => ProjectName.sln (73%) delete mode 100644 ProjectName/DllMap.cs delete mode 100644 ProjectName/ProjectName.Framework.csproj rename {ProjectName => src}/Graphics/Containers/Framebuffers.cs (100%) rename {ProjectName => src}/Graphics/Containers/RenderPasses.cs (100%) rename {ProjectName => src}/Graphics/Containers/RenderTargets.cs (100%) rename {ProjectName => src}/Graphics/GraphicsObjects.cs (100%) rename {ProjectName => src}/Program.cs (72%) rename {ProjectName => src}/ProjectNameGame.cs (93%) diff --git a/.vscode/launch.json b/.vscode/launch.json index c4f8997..3c21acb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,36 +1,14 @@ { "version": "0.2.0", "configurations": [ - { - "name": "Attach to Framework Debugger", - "type": "clr", - "request": "launch", - "preLaunchTask": "Build: Framework Debug", - "program": "${workspaceFolder}/ProjectName/bin/x64/Debug/net472/ProjectName.exe", - "args": [], - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Debug/net472", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - }, - { - "name": "Attach to Mono Debugger", - "type": "mono", - "request": "launch", - "preLaunchTask": "Build: Mono Debug", - "program": "${workspaceFolder}/ProjectName/bin/x64/Debug/net472/ProjectName.exe", - "args": [], - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Debug/net472", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - }, { "name": "Attach to .NET 5 Debugger", "type": "coreclr", "request": "launch", "preLaunchTask": "Build: .NET 5 Debug", - "program": "${workspaceFolder}/ProjectName/bin/x64/Debug/net5.0/ProjectName.dll", + "program": "${workspaceFolder}/bin/x64/Debug/net5.0/ProjectName.dll", "args": [], - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Debug/net5.0", + "cwd": "${workspaceFolder}/bin/x64/Debug/net5.0", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1a2cfc1..5f699b7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -20,106 +20,6 @@ "panel": "shared" }, "tasks": [ - { - "label": "Build: Mono Release", - "command": "msbuild", - "args": [ - "-restore:True", - "${workspaceFolder}/ProjectName.Framework.sln", - "-p:Configuration=Release", - "-p:Platform=x64" - ], - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": "$msCompile" - }, - { - "label": "Run: Mono Release", - "command": "mono", - "args": [ - "ProjectName.exe" - ], - "options": { - "env": { - "LD_LIBRARY_PATH": "./lib64", - "DYLD_LIBRARY_PATH": "./osx" - }, - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Release/net472" - }, - "type": "process", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Build & Run: Mono Release", - "dependsOn": [ - "Build: Mono Release", - "Run: Mono Release" - ], - "dependsOrder": "sequence", - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Build: Mono Debug", - "command": "msbuild", - "args": [ - "-restore:True", - "${workspaceFolder}/ProjectName.Framework.sln", - "-p:Configuration=Debug", - "-p:Platform=x64" - ], - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Run: Mono Debug", - "command": "mono", - "args": [ - "ProjectName.exe" - ], - "options": { - "env": { - "LD_LIBRARY_PATH": "./lib64", - "DYLD_LIBRARY_PATH": "./osx" - }, - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Debug/net472" - }, - "type": "process", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Build & Run: Mono Debug", - "dependsOn": [ - "Build: Mono Debug", - "Run: Mono Debug" - ], - "dependsOrder": "sequence", - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, { "label": "Build & Run: .NET 5 Debug", "type": "shell", @@ -139,7 +39,7 @@ "command": "dotnet", "args": [ "build", - "./ProjectName/ProjectName.Core.csproj", + "./ProjectName.csproj", "-p:SolutionDir=${workspaceFolder}/", "-p:Platform=x64" ], @@ -161,7 +61,7 @@ "LD_LIBRARY_PATH": "./lib64", "DYLD_LIBRARY_PATH": "./osx" }, - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Debug/net5.0" + "cwd": "${workspaceFolder}/bin/x64/Debug/net5.0" }, "type": "process", "group": { @@ -175,7 +75,7 @@ "command": "dotnet", "args": [ "build", - "./ProjectName/ProjectName.Core.csproj", + "./ProjectName.csproj", "--configuration", "Release", "-p:SolutionDir=${workspaceFolder}/", @@ -199,7 +99,7 @@ "LD_LIBRARY_PATH": "./lib64", "DYLD_LIBRARY_PATH": "./osx" }, - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Release/net5.0" + "cwd": "${workspaceFolder}/bin/x64/Release/net5.0" }, "type": "process", "group": { @@ -221,92 +121,6 @@ "isDefault": true }, "problemMatcher": [] - }, - { - "label": "Build: Framework Debug", - "command": "MsBuild.exe", - "args": [ - "-restore:True", - "${workspaceFolder}/ProjectName.Framework.sln", - "-p:Configuration=Debug", - "-p:Platform=x64" - ], - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Run: Framework Debug", - "command": "ProjectName.exe", - "options": { - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Debug/net472" - }, - "type": "process", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Build & Run: Framework Debug", - "dependsOn": [ - "Build: Framework Debug", - "Run: Framework Debug" - ], - "dependsOrder": "sequence", - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Build: Framework Release", - "command": "MsBuild.exe", - "args": [ - "-restore:True", - "${workspaceFolder}/ProjectName.Framework.sln", - "-p:Configuration=Release", - "-p:Platform=x64" - ], - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Run: Framework Release", - "command": "ProjectName.exe", - "options": { - "cwd": "${workspaceFolder}/ProjectName/bin/x64/Release/net472" - }, - "type": "process", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "Build & Run: Framework Release", - "dependsOn": [ - "Build: Framework Release", - "Run: Framework Release" - ], - "dependsOrder": "sequence", - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] } ] } diff --git a/ProjectName/Content/README.md b/Content/README.md similarity index 100% rename from ProjectName/Content/README.md rename to Content/README.md diff --git a/ProjectName/CopyMoonlibs.targets b/CopyMoonlibs.targets similarity index 63% rename from ProjectName/CopyMoonlibs.targets rename to CopyMoonlibs.targets index 7b481da..f510ec0 100644 --- a/ProjectName/CopyMoonlibs.targets +++ b/CopyMoonlibs.targets @@ -5,26 +5,26 @@ - - + + %(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + %(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + %(RecursiveDir)%(Filename)%(Extension) PreserveNewest - - + + %(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + %(RecursiveDir)%(Filename)%(Extension) PreserveNewest @@ -33,8 +33,8 @@ PreserveNewest - - + + %(RecursiveDir)%(Filename)%(Extension) PreserveNewest diff --git a/ProjectName.Framework.sln b/ProjectName.Framework.sln deleted file mode 100644 index bebd481..0000000 --- a/ProjectName.Framework.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30717.126 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectName.Framework", "ProjectName\ProjectName.Framework.csproj", "{9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Debug|x64.ActiveCfg = Debug|x64 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Debug|x64.Build.0 = Debug|x64 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Debug|x86.ActiveCfg = Debug|x86 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Debug|x86.Build.0 = Debug|x86 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Release|x64.ActiveCfg = Release|x64 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Release|x64.Build.0 = Release|x64 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Release|x86.ActiveCfg = Release|x86 - {9ED076FA-32C3-4F1E-BB90-549B3A2FA46F}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {4DB7BE1E-CAC6-4275-B514-20CBE80F794F} - EndGlobalSection -EndGlobal diff --git a/ProjectName/ProjectName.Core.csproj b/ProjectName.csproj similarity index 67% rename from ProjectName/ProjectName.Core.csproj rename to ProjectName.csproj index d450a0d..2d6b182 100644 --- a/ProjectName/ProjectName.Core.csproj +++ b/ProjectName.csproj @@ -1,11 +1,12 @@ - - - obj\$(MSBuildProjectName) - x64;x86 - - + - WinExe + Exe + net5.0 + true + + + + Exe net5.0 ProjectName false @@ -15,17 +16,22 @@ ProjectName ProjectName true - true + Always + + + $(DefaultItemExcludes);lib\**\* + + - + + - diff --git a/ProjectName.Core.sln b/ProjectName.sln similarity index 73% rename from ProjectName.Core.sln rename to ProjectName.sln index 1800f4f..407ef79 100644 --- a/ProjectName.Core.sln +++ b/ProjectName.sln @@ -1,31 +1,25 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30717.126 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectName.Core", "ProjectName\ProjectName.Core.csproj", "{4589302C-174A-4173-9654-CAA6CA1B5220}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4589302C-174A-4173-9654-CAA6CA1B5220}.Debug|x64.ActiveCfg = Debug|x64 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Debug|x64.Build.0 = Debug|x64 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Debug|x86.ActiveCfg = Debug|x86 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Debug|x86.Build.0 = Debug|x86 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Release|x64.ActiveCfg = Release|x64 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Release|x64.Build.0 = Release|x64 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Release|x86.ActiveCfg = Release|x86 - {4589302C-174A-4173-9654-CAA6CA1B5220}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {70247DA8-9C19-4FC5-B4BC-68E1262B9F4B} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30717.126 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectName.Core", "ProjectName\ProjectName.Core.csproj", "{4589302C-174A-4173-9654-CAA6CA1B5220}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4589302C-174A-4173-9654-CAA6CA1B5220}.Debug|x64.ActiveCfg = Debug|x64 + {4589302C-174A-4173-9654-CAA6CA1B5220}.Debug|x64.Build.0 = Debug|x64 + {4589302C-174A-4173-9654-CAA6CA1B5220}.Release|x64.ActiveCfg = Release|x64 + {4589302C-174A-4173-9654-CAA6CA1B5220}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {70247DA8-9C19-4FC5-B4BC-68E1262B9F4B} + EndGlobalSection +EndGlobal diff --git a/ProjectName/DllMap.cs b/ProjectName/DllMap.cs deleted file mode 100644 index a426f32..0000000 --- a/ProjectName/DllMap.cs +++ /dev/null @@ -1,259 +0,0 @@ -// only works in .NET Core. disable in .NET framework - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Xml.Linq; - -public static class DllMap -{ - [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool SetDefaultDllDirectories(int directoryFlags); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - static extern void AddDllDirectory(string lpPathName); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool SetDllDirectory(string lpPathName); - - const int LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000; - - public static Dictionary MapDictionary; - public static string OS; - public static string CPU; - public static bool Optimise; - - public static void Initialise(bool optimise = true) - { - Optimise = optimise; - - // Our executabe needs to know how to find the native libraries - // For Windows, we can set this to be x86 or x64 directory at runtime (below) - // For Linux we need to move our native libraries to 'netcoredeps' which is set by .net core - // For OSX we need to set an environment variable (DYLD_LIBRARY_PATH) outside of the process by a script - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - { - try - { - SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); - AddDllDirectory(Path.Combine( - AppDomain.CurrentDomain.BaseDirectory, - Environment.Is64BitProcess ? "x64" : "x86" - )); - } - catch - { - // Pre-Windows 7, KB2533623 - SetDllDirectory(Path.Combine( - AppDomain.CurrentDomain.BaseDirectory, - Environment.Is64BitProcess ? "x64" : "x86" - )); - } - } - - // .NET Core also doesn't use DllImport but we can replicate this using NativeLibrary as per below - // Uses MoonWorks.dll.config to dictate what the name of the native library is per platform and architecture - var moonWorksAssembly = Assembly.GetAssembly(typeof(Microsoft.Xna.Framework.Graphics.ColorWriteChannels)); - DllMap.Register(moonWorksAssembly); - } - - // Register a call-back for native library resolution. - public static void Register(Assembly assembly) - { - NativeLibrary.SetDllImportResolver(assembly, MapAndLoad); - - // Do setup so that MapLibraryName is faster than reading the XML each time - - // 1) Get platform & cpu - OS = GetCurrentPlatform().ToString().ToLowerInvariant(); - CPU = GetCurrentRuntimeArchitecture().ToString().ToLowerInvariant(); - - // 2) Setup MapDictionary - // For Windows use hardcoded values - // Why? This is our development platform and we wanted the fastest start time possible (eliminates XML Load) - if (OS == "windows" && Optimise) - { - MapDictionary = new Dictionary(); - MapDictionary.Add("SDL2", "SDL2.dll"); - MapDictionary.Add("Refresh", "Refresh.dll"); - MapDictionary.Add("FAudio", "FAudio.dll"); - } - else - { - // For every other platform use XML file - // Read in config XML and only store details we're interested in within MapDictionary - string xmlPath = Path.Combine(Path.GetDirectoryName(assembly.Location), - Path.GetFileNameWithoutExtension(assembly.Location) + ".dll.config"); - - if (!File.Exists(xmlPath)) - { - Console.WriteLine($"=== Cannot find XML: " + xmlPath); - return; - } - - XElement root = XElement.Load(xmlPath); - - MapDictionary = new Dictionary(); - ParseXml(root, true); // Direct match on OS & CPU first - ParseXml(root, false); // Loose match on CPU second (won't allow duplicates) - } - } - - private static void ParseXml(XElement root, bool matchCPU) - { - foreach (var el in root.Elements("dllmap")) - { - // Ignore entries for other OSs - if (el.Attribute("os").ToString().IndexOf(OS) < 0) - continue; - - // Ignore entries for other CPUs - if (matchCPU) - { - if (el.Attribute("cpu") == null) - continue; - if (el.Attribute("cpu").ToString().IndexOf(CPU) < 0) - continue; - } - else - { - if (el.Attribute("cpu") != null && el.Attribute("cpu").ToString().IndexOf(CPU) < 0) - continue; - } - - string oldLib = el.Attribute("dll").Value; - string newLib = el.Attribute("target").Value; - if (string.IsNullOrWhiteSpace(oldLib) || string.IsNullOrWhiteSpace(newLib)) - continue; - - // Don't allow duplicates - if (MapDictionary.ContainsKey(oldLib)) - continue; - - MapDictionary.Add(oldLib, newLib); - } - } - - // The callback: which loads the mapped libray in place of the original - private static IntPtr MapAndLoad(string libraryName, Assembly assembly, DllImportSearchPath? dllImportSearchPath) - { - string mappedName = null; - mappedName = MapLibraryName(assembly.Location, libraryName, out mappedName) ? mappedName : libraryName; - return NativeLibrary.Load(mappedName, assembly, dllImportSearchPath); - } - - // Parse the assembly.xml file, and map the old name to the new name of a library. - private static bool MapLibraryName(string assemblyLocation, string originalLibName, out string mappedLibName) - { - if (MapDictionary.TryGetValue(originalLibName, out mappedLibName)) - return true; - else - return false; - } - - // Below pinched from Mono.DllMap project: https://github.com/Firwood-Software/AdvancedDLSupport/tree/1b7394211a655b2f77649ce3b610a3161215cbdc/Mono.DllMap - public static DllMapOS GetCurrentPlatform() - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - return DllMapOS.Linux; - } - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - return DllMapOS.Windows; - } - - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return DllMapOS.OSX; - } - - var operatingDesc = RuntimeInformation.OSDescription.ToUpperInvariant(); - foreach (var system in Enum.GetValues(typeof(DllMapOS)).Cast() - .Except(new[] { DllMapOS.Linux, DllMapOS.Windows, DllMapOS.OSX })) - { - if (operatingDesc.Contains(system.ToString().ToUpperInvariant())) - { - return system; - } - } - - throw new PlatformNotSupportedException($"Couldn't detect platform: {RuntimeInformation.OSDescription}"); - } - - public static DllMapArchitecture GetCurrentRuntimeArchitecture() - { - switch (RuntimeInformation.ProcessArchitecture) - { - case Architecture.Arm: - { - return DllMapArchitecture.ARM; - } - case Architecture.X64: - { - return DllMapArchitecture.x86_64; - } - case Architecture.X86: - { - return DllMapArchitecture.x86; - } - } - - typeof(object).Module.GetPEKind(out _, out var machine); - switch (machine) - { - case ImageFileMachine.I386: - { - return DllMapArchitecture.x86; - } - case ImageFileMachine.AMD64: - { - return DllMapArchitecture.x86_64; - } - case ImageFileMachine.ARM: - { - return DllMapArchitecture.ARM; - } - case ImageFileMachine.IA64: - { - return DllMapArchitecture.IA64; - } - } - throw new PlatformNotSupportedException("Couldn't detect the current architecture."); - } - - public enum DllMapOS - { - Linux = 1 << 0, - OSX = 1 << 1, - Solaris = 1 << 2, - FreeBSD = 1 << 3, - OpenBSD = 1 << 4, - NetBSD = 1 << 5, - Windows = 1 << 6, - AIX = 1 << 7, - HPUX = 1 << 8 - } - - public enum DllMapArchitecture - { - x86 = 1 << 0, - x86_64 = 1 << 1, - SPARC = 1 << 2, - PPC = 1 << 3, - S390 = 1 << 4, - S390X = 1 << 5, - ARM = 1 << 6, - ARMV8 = 1 << 7, - MIPS = 1 << 8, - Alpha = 1 << 9, - HPPA = 1 << 10, - IA64 = 1 << 11 - } -} diff --git a/ProjectName/ProjectName.Framework.csproj b/ProjectName/ProjectName.Framework.csproj deleted file mode 100644 index f9907d5..0000000 --- a/ProjectName/ProjectName.Framework.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - obj\$(MSBuildProjectName) - x64;x86 - - - - Exe - net472 - ProjectName - false - false - 8.0 - ProjectName.Program - ProjectName - ProjectName - true - true - - - - $(DefaultItemExcludes);DllMap.cs - - - - Always - - - - - - - - diff --git a/install.sh b/install.sh index e0f2067..86b3d7c 100755 --- a/install.sh +++ b/install.sh @@ -84,7 +84,7 @@ fi cp -R "$MY_DIR" "$NEW_PROJECT_DIR" cd "$NEW_PROJECT_DIR" -files=(ProjectName.Core.sln ProjectName.Framework.sln .gitignore ProjectName/ProjectName.Core.csproj ProjectName/ProjectName.Framework.csproj ProjectName/ProjectNameGame.cs ProjectName/Program.cs ProjectName/Graphics/GraphicsObjects.cs ProjectName/Graphics/Containers/Framebuffers.cs ProjectName/Graphics/Containers/RenderPasses.cs ProjectName/Graphics/Containers/RenderTargets.cs .vscode/tasks.json .vscode/launch.json) +files=(ProjectName.sln .gitignore ProjectName.csproj src/ProjectNameGame.cs src/Program.cs src/Graphics/GraphicsObjects.cs src/Graphics/Containers/Framebuffers.cs src/Graphics/Containers/RenderPasses.cs src/Graphics/Containers/RenderTargets.cs .vscode/tasks.json .vscode/launch.json) for file in "${files[@]}"; do sed -i -e "s/ProjectName/$newProjectName/g" "./$file" if [ "$(uname)" == "Darwin" ]; then @@ -92,23 +92,20 @@ for file in "${files[@]}"; do fi done -mv ./ProjectName.Core.sln "./$newProjectName.Core.sln" -mv ./ProjectName.Framework.sln "./$newProjectName.Framework.sln" -mv ./ProjectName/ProjectName.Core.csproj "./ProjectName/$newProjectName.Core.csproj" -mv ./ProjectName/ProjectName.Framework.csproj "./ProjectName/$newProjectName.Framework.csproj" -mv ./ProjectName/ProjectNameGame.cs ./ProjectName/${newProjectName}Game.cs -mv ./ProjectName "./$newProjectName" +mv ./ProjectName.sln "./$newProjectName.sln" +mv ./ProjectName.csproj "./$newProjectName.csproj" +mv ./src/ProjectNameGame.cs ./src/${newProjectName}Game.cs rm ./install.sh rm ./LICENSE rm -rf .git git init -git branch -m main +git checkout -b main +git branch -D master mkdir lib pullMoonWorks -dotnet sln ${newProjectName}.Framework.sln add lib/MoonWorks/MoonWorks.csproj -dotnet sln ${newProjectName}.Core.sln add lib/MoonWorks/MoonWorks.csproj +dotnet sln ${newProjectName}.sln add lib/MoonWorks/MoonWorks.csproj echo "Project $newProjectName created at: " diff --git a/ProjectName/Graphics/Containers/Framebuffers.cs b/src/Graphics/Containers/Framebuffers.cs similarity index 100% rename from ProjectName/Graphics/Containers/Framebuffers.cs rename to src/Graphics/Containers/Framebuffers.cs diff --git a/ProjectName/Graphics/Containers/RenderPasses.cs b/src/Graphics/Containers/RenderPasses.cs similarity index 100% rename from ProjectName/Graphics/Containers/RenderPasses.cs rename to src/Graphics/Containers/RenderPasses.cs diff --git a/ProjectName/Graphics/Containers/RenderTargets.cs b/src/Graphics/Containers/RenderTargets.cs similarity index 100% rename from ProjectName/Graphics/Containers/RenderTargets.cs rename to src/Graphics/Containers/RenderTargets.cs diff --git a/ProjectName/Graphics/GraphicsObjects.cs b/src/Graphics/GraphicsObjects.cs similarity index 100% rename from ProjectName/Graphics/GraphicsObjects.cs rename to src/Graphics/GraphicsObjects.cs diff --git a/ProjectName/Program.cs b/src/Program.cs similarity index 72% rename from ProjectName/Program.cs rename to src/Program.cs index e133104..1c1a6e6 100644 --- a/ProjectName/Program.cs +++ b/src/Program.cs @@ -15,18 +15,6 @@ namespace ProjectName static void Main(string[] args) { -#if NETCOREAPP - DllMap.Initialise(false); -#endif - - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - { - SetDllDirectory(Path.Combine( - AppDomain.CurrentDomain.BaseDirectory, - Environment.Is64BitProcess ? "x64" : "x86" - )); - } - WindowCreateInfo windowCreateInfo = new WindowCreateInfo { WindowWidth = 1280, @@ -44,4 +32,4 @@ namespace ProjectName game.Run(); } } -} \ No newline at end of file +} diff --git a/ProjectName/ProjectNameGame.cs b/src/ProjectNameGame.cs similarity index 93% rename from ProjectName/ProjectNameGame.cs rename to src/ProjectNameGame.cs index 0ce3a0b..4bed11d 100644 --- a/ProjectName/ProjectNameGame.cs +++ b/src/ProjectNameGame.cs @@ -28,12 +28,12 @@ namespace ProjectName RenderHeight = (int)windowCreateInfo.WindowHeight; } - protected override void Update(double dt) + protected override void Update(System.TimeSpan dt) { // Insert your game update logic here. } - protected override void Draw(double dt, double alpha) + protected override void Draw(System.TimeSpan dt, double alpha) { // Replace this with your own drawing code.