diff --git a/project_name/.vscode/buildEffects.sh b/.vscode/buildEffects.sh similarity index 97% rename from project_name/.vscode/buildEffects.sh rename to .vscode/buildEffects.sh index 5e0174e..1cd37eb 100755 --- a/project_name/.vscode/buildEffects.sh +++ b/.vscode/buildEffects.sh @@ -6,6 +6,7 @@ printf "Starting build process...\n" +cd project_name for file in `find ./Content/** -name "*.fx"` ; do # Hush, wine... diff --git a/project_name/.vscode/launch.json b/.vscode/launch.json similarity index 79% rename from project_name/.vscode/launch.json rename to .vscode/launch.json index d2adc58..cae6c1a 100644 --- a/project_name/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,12 +8,12 @@ "name": "Launch", "type": "mono", "request": "launch", - "program": "${workspaceFolder}/bin/Debug/project_name.exe", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "cwd": "${workspaceFolder}", "preLaunchTask": "Build (Debug)", "osx":{ "env": { - "DYLD_LIBRARY_PATH": "${workspaceFolder}/bin/Debug/osx/" + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" }, } }, diff --git a/project_name/.vscode/processT4Templates.sh b/.vscode/processT4Templates.sh similarity index 97% rename from project_name/.vscode/processT4Templates.sh rename to .vscode/processT4Templates.sh index 06531f9..8461ec8 100755 --- a/project_name/.vscode/processT4Templates.sh +++ b/.vscode/processT4Templates.sh @@ -6,6 +6,7 @@ printf "Starting T4 processing...\n" +cd project_name for file in `find ./T4Templates/** -name "*.tt"` ; do # Build the template diff --git a/project_name/.vscode/settings.json b/.vscode/settings.json similarity index 100% rename from project_name/.vscode/settings.json rename to .vscode/settings.json diff --git a/project_name/.vscode/tasks.json b/.vscode/tasks.json similarity index 80% rename from project_name/.vscode/tasks.json rename to .vscode/tasks.json index dc3564f..d609b37 100644 --- a/project_name/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,7 @@ { "label": "Clean Project", "type": "shell", - "command": "msbuild /t:clean /p:configuration=Debug ; msbuild /t:clean /p:configuration=Release", + "command": "msbuild project_name /t:clean /p:configuration=Debug ; msbuild project_name /t:clean /p:configuration=Release", "group": "build", "problemMatcher": "$msCompile", }, @@ -22,6 +22,7 @@ "type": "shell", "command": "msbuild", "args": [ + "project_name", "/p:configuration=Debug", "/t:build" ], @@ -35,6 +36,7 @@ "type": "shell", "command": "msbuild", "args": [ + "project_name", "/p:configuration=Release", "/t:build" ], @@ -47,13 +49,13 @@ "type": "shell", "group": "build", "osx":{ - "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/bin/Debug/osx/ mono ${workspaceFolder}/bin/Debug/project_name.exe" + "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/project_name/bin/Debug/osx/ mono ${workspaceFolder}/project_name/bin/Debug/project_name.exe" }, "windows":{ "command": "cmd", "args": [ "/k", - "${workspaceFolder}/bin/Debug/project_name.exe" + "${workspaceFolder}/project_name/bin/Debug/project_name.exe" ] }, "dependsOn": "Build (Debug)", @@ -65,13 +67,13 @@ "type": "shell", "group": "build", "osx":{ - "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/bin/Release/osx/ mono ${workspaceFolder}/bin/Release/project_name.exe" + "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/project_name/bin/Release/osx/ mono ${workspaceFolder}/project_name/bin/Release/project_name.exe" }, "windows":{ "command": "cmd", "args": [ "/k", - "${workspaceFolder}/bin/Release/project_name.exe" + "${workspaceFolder}/project_name/bin/Release/project_name.exe" ] }, "dependsOn": "Build (Release)", @@ -97,7 +99,7 @@ "group": "build", "command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb", "options": { - "cwd": "${workspaceFolder}/CompiledContent" + "cwd": "${workspaceFolder}/project_name/CompiledContent" }, "problemMatcher": "$msCompile" }, @@ -108,7 +110,7 @@ "group": "build", "command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb -r", "options": { - "cwd": "${workspaceFolder}/CompiledContent" + "cwd": "${workspaceFolder}/project_name/CompiledContent" }, "problemMatcher": "$msCompile" }, @@ -117,7 +119,7 @@ "label": "Open Pipeline Tool", "type": "shell", "group": "build", - "command": "export MONOGAME_PIPELINE_PROJECT=${workspaceFolder}/CompiledContent/Content.mgcb && /Applications/Pipeline.app/Contents/MacOS/Pipeline", + "command": "export MONOGAME_PIPELINE_PROJECT=${workspaceFolder}/project_name/CompiledContent/Content.mgcb && /Applications/Pipeline.app/Contents/MacOS/Pipeline", "problemMatcher": "$msCompile" }, diff --git a/README.md b/README.md index 2b0f96b..9ff168e 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Start new FNA projects with Nez quickly and easily with handy setup scripts, a v ## Setup Instructions ## 1. Download and unzip the ZIP archive (don't clone the repo!) 2. Run `./getFNA.sh` (macOS) to download the latest Nez, FNA and fnalibs to the directory. You can run this script again if you want to update either FNA or the fnalibs at a later point. Nez is setup as a submodule so you can update it in the normal fashion. -3. Open the newly-created and named `PROJECT_NAME_YOU_CHOSE.code-workspace` file (or open the project folder in Visual Studio Code or the top-level sln in Visual Studio) +3. Open the root folder that contains the .sln file in Visual Studio Code or the .sln file directly in Visual Studio -That's it! Now you're ready to build and run the base project. When developing raw content (files not processed by the Pipeline tool) should be placed in the `Content` folder and anything that needs processing should go in the `CompiledContent` folder and added to the Pipeline tool. +That's it! Now you're ready to build and run the base project. When developing, raw content (files not processed by the Pipeline tool) should be placed in the `Content` folder and anything that needs processing should go in the `CompiledContent` folder and added to the Pipeline tool. The setup process will also init a git repo for you with Nez added as a submodule. diff --git a/getFNA.sh b/getFNA.sh index 2e1d67a..c39e27b 100755 --- a/getFNA.sh +++ b/getFNA.sh @@ -141,17 +141,17 @@ if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then exit 1 fi -sed -i '' "s/project_name/$newProjectName/g" project_name.code-workspace sed -i '' "s/project_name/$newProjectName/g" project_name.sln sed -i '' "s/project_name/$newProjectName/g" .gitignore sed -i '' "s/project_name/$newProjectName/g" project_name/project_name.sln sed -i '' "s/project_name/$newProjectName/g" project_name/project_name.csproj -sed -i '' "s/project_name/$newProjectName/g" project_name/Game1.cs +sed -i '' "s/project_name/$newProjectName/g" project_name/Game1.cs sed -i '' "s/project_name/$newProjectName/g" project_name/Program.cs -sed -i '' "s/project_name/$newProjectName/g" project_name/.vscode/tasks.json -sed -i '' "s/project_name/$newProjectName/g" project_name/.vscode/launch.json +sed -i '' "s/project_name/$newProjectName/g" .vscode/tasks.json +sed -i '' "s/project_name/$newProjectName/g" .vscode/launch.json +sed -i '' "s/project_name/$newProjectName/g" .vscode/buildEffects.sh +sed -i '' "s/project_name/$newProjectName/g" .vscode/processT4Templates.sh -mv project_name.code-workspace "$newProjectName.code-workspace" mv project_name.sln "$newProjectName.sln" mv project_name/project_name.sln "project_name/$newProjectName.sln" mv project_name/project_name.csproj "project_name/$newProjectName.csproj" @@ -159,7 +159,7 @@ mv project_name/project_name.csproj.user "project_name/$newProjectName.csproj.us mv project_name "$newProjectName" git init -git submodule add git@github.com:prime31/Nez.FNA.git +git submodule add https://github.com/prime31/Nez.FNA.git cd Nez.FNA git submodule init git submodule update diff --git a/project_name.code-workspace b/project_name.code-workspace deleted file mode 100644 index a2a64fb..0000000 --- a/project_name.code-workspace +++ /dev/null @@ -1,14 +0,0 @@ -{ - "folders": [ - { - "path": "project_name" - }, - { - "path": "Nez.FNA/Nez/Nez.Portable" - } - ], - "settings": { - "omnisharp.autoStart": true, - "csharp.referencesCodeLens.enabled": false - } -} \ No newline at end of file diff --git a/project_name.sln b/project_name.sln index 76a9c87..8a4b74f 100644 --- a/project_name.sln +++ b/project_name.sln @@ -6,39 +6,15 @@ Debug|Any CPU = Debug|Any CPU Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|x86 = Release|x86 + GlobalSection(ProjectConfigurationPlatforms) = postSolution -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Debug|Any CPU.Build.0 = Debug|Any CPU -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Debug|x86.ActiveCfg = Debug|x86 -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Debug|x86.Build.0 = Debug|x86 -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Release|Any CPU.ActiveCfg = Release|Any CPU -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Release|Any CPU.Build.0 = Release|Any CPU -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Release|x86.ActiveCfg = Release|x86 -{D488C5AD-5192-4A08-88FD-22219586ED9F}.Release|x86.Build.0 = Release|x86 -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|Any CPU.Build.0 = Debug|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|x86.ActiveCfg = Debug|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|x86.Build.0 = Debug|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|Any CPU.Build.0 = Release|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|x86.ActiveCfg = Release|Any CPU -{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|x86.Build.0 = Release|Any CPU -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Debug|Any CPU.ActiveCfg = Debug|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Debug|Any CPU.Build.0 = Debug|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Debug|x86.ActiveCfg = Debug|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Debug|x86.Build.0 = Debug|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Release|Any CPU.ActiveCfg = Release|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Release|Any CPU.Build.0 = Release|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Release|x86.ActiveCfg = Release|x86 -{F6DF8289-8138-41C7-B747-E672AFEE44A4}.Release|x86.Build.0 = Release|x86 -GlobalSection(SolutionProperties) = preSolution -HideSolutionNode = FALSE Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "project_name", "project_name\project_name.csproj", "{8C576ECC-147D-4B4A-8EC1-56533D26A178}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FNA", "FNA\FNA.csproj", "{35253CE1-C864-4CD3-8249-4D1319748E8F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nez.FNA", "Nez.FNA\Nez.FNA\Nez.FNA.csproj", "{11A5855C-B12C-4F8D-B935-56F3D0B671C3}" EndProject + Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {8C576ECC-147D-4B4A-8EC1-56533D26A178}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/project_name/T4Templates/ContentPathGenerator.tt b/project_name/T4Templates/ContentPathGenerator.tt index 3376cc3..876e4e6 100644 --- a/project_name/T4Templates/ContentPathGenerator.tt +++ b/project_name/T4Templates/ContentPathGenerator.tt @@ -49,6 +49,9 @@ namespace Nez <#+ + // all the valid file extensions we should add to the output file + private string[] fileExtensionsToCopy = new string[] { ".xnb", ".png", ".ogg", ".wav", ".fxb" }; + // C# reserved keywords private System.Collections.Generic.List keywords = new System.Collections.Generic.List { @@ -63,7 +66,7 @@ namespace Nez void printDirectoryClass( string dir, int depth, string sourceFolder ) { var dirInfo = new DirectoryInfo( dir ); - var firstIndent = new string( ' ', depth * 5 ); + var firstIndent = new string( ' ', depth * 4 ); var className = generateClassName( dirInfo.Name, true ); WriteLine( "{0}public static class {1}\n{2}{{", firstIndent, className, firstIndent ); @@ -81,10 +84,10 @@ namespace Nez // prints a const string for each file in the directory void printContentFiles( string dir, int depth, string sourceFolder ) { - var firstIndent = new string( '\t', depth ); + var firstIndent = new string( ' ', depth * 4 ); var files = Directory.EnumerateFiles( dir ) - .Where( s => s.EndsWith( ".xnb" ) || s.EndsWith( ".png" ) || s.EndsWith( ".ogg" ) || s.EndsWith( ".wav" ) || s.EndsWith( ".fxb" ) ); + .Where( s => Array.IndexOf( fileExtensionsToCopy, Path.GetExtension( s ) ) >= 0 ); foreach( var file in files ) { // clear out all of the path up to the sourceFolder so we get just the relative path to the Content folder diff --git a/project_name/project_name.sln b/project_name/project_name.sln deleted file mode 100644 index 8576363..0000000 --- a/project_name/project_name.sln +++ /dev/null @@ -1,24 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "project_name", "project_name.csproj", "{BD11109C-8FD1-4FFE-A3EF-8390A1EAE1A1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FNA", "../FNA/FNA.csproj", "{35253CE1-C864-4CD3-8249-4D1319748E8F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nez.FNA", "../Nez.FNA/Nez.FNA/Nez.FNA.csproj", "{11A5855C-B12C-4F8D-B935-56F3D0B671C3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nez.PipelineImporter", "../Nez.FNA/Nez/Nez.PipelineImporter/Nez.PipelineImporter.csproj", "{63E831F4-B847-4150-B5AF-CBE059EE27B8}" -EndProject - -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BD11109C-8FD1-4FFE-A3EF-8390A1EAE1A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD11109C-8FD1-4FFE-A3EF-8390A1EAE1A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD11109C-8FD1-4FFE-A3EF-8390A1EAE1A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD11109C-8FD1-4FFE-A3EF-8390A1EAE1A1}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal