diff --git a/README.md b/README.md index 1b3b848..d6f57e9 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ # FNA VSCode Template -Start new FNA projects quickly and easily with handy setup scripts, a versatile boilerplate project, and convenient Visual Studio Code integration. +Start new FNA projects with Nez quickly and easily with handy setup scripts, a versatile boilerplate project, and convenient Visual Studio Code integration. + ## Features ## -- Super simple setup scripts that download and install FNA and its native libraries for you! -- Boilerplate project already included -- no need to wrestle with MSBuild configurations or writing yet another Game1 class. -- Visual Studio Code tasks for building and running your game, cleaning/restoring your project, and compiling .fx files! -- In-editor debugging support with the Mono Debugger. -- Supports Windows and macOS! +- Super simple setup scripts that download and install Nez, FNA and its native libraries for you +- Boilerplate project already included -- no need to wrestle with MSBuild configurations or writing yet another Game1 class +- Visual Studio Code tasks for building and running your game, cleaning/restoring your project, compiling .fx files and building content with the MonoGame Pipeline tool +- In-editor debugging support with the Mono Debugger + ## Prerequisites ## - [Visual Studio Code](https://code.visualstudio.com) @@ -17,17 +18,16 @@ Start new FNA projects quickly and easily with handy setup scripts, a versatile - [7-Zip](https://www.7-zip.org) (required for Windows to decompress fnalibs) - [Microsoft DirectX SDK (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=6812) (required for building effects -- on Mac, [you can use Wine to run this](https://github.com/AndrewRussellNet/FNA-Template#linuxmacos-installing-the-directx-sdk-on-wine)) + ## Setup Instructions ## -1. Download and unzip the ZIP archive. -2. Copy+paste the resulting folder to your desired project directory. -3. Run `./getFNA.sh` (macOS) or `./win_getFNA.ps1` (Windows PowerShell) to download the latest FNA and fnalibs to the directory. (You can run this script again if you want to update either FNA or the libraries at a later point.) -4. Rename `project_name` to your project's name (the folder and the csproj file) -5. Open the newly-renamed project folder (NOT the root folder!) in Visual Studio Code. -6. Do a Find+Replace for "project_name" (case sensitive!) to the new name of your project. -7. Run the "Restore Project" build task. +1. Download and unzip the ZIP archive (don't clone the repo!) +2. Copy+paste the resulting folder to your desired project directory +3. 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 libraries at a later point. Nez is setup as a submodule so you can update it in the normal fashion. +4. Open the newly-created and named `code-workspace` file (or open the project folder in Visual Studio Code or the top-level sln in Visual Studio) That's it! Now you're ready to build and run the base project! + ## Build Tasks ## - **Restore Project:** Restores the .csproj. Run this before building for the first time, and run it again whenever you change the .csproj file. - **Build (Debug/Release):** Builds the project with the specified configuration but does not run it. This also copies over everything in the Content/ subdirectory and the fnalibs. @@ -36,6 +36,7 @@ That's it! Now you're ready to build and run the base project! - **Build Effects:** Runs `fxc.exe` on all of the `.fx` files found in the Content/ subdirectories and outputs corresponding `.fxb` files that can be loaded through the Content Manager at runtime. - **Build Content:** Runs good old MGCB.exe on the Content.mgcb file - **Force Build Content:** Force builds the content (MGCB.exe -r) +- **Open Pipeline Tool:** Opens the MonoGame Pipeline tool ## License and Credits ## diff --git a/getFNA.sh b/getFNA.sh index 5e4c6ff..0b4604b 100755 --- a/getFNA.sh +++ b/getFNA.sh @@ -21,7 +21,7 @@ function downloadFNA() echo "Downloading FNA..." git -C $MY_DIR clone https://github.com/FNA-XNA/FNA.git --recursive if [ $? -eq 0 ]; then - echo "Finished downloading!" + echo "Finished downloading!\n" else echo >&2 "ERROR: Unable to download successfully. Maybe try again later?" fi @@ -34,7 +34,7 @@ function updateFNA() echo "Updating to the latest git version of FNA..." git -C "$MY_DIR/FNA" pull --recurse-submodules if [ $? -eq 0 ]; then - echo "Finished updating!" + echo "Finished updating!\n" else echo >&2 "ERROR: Unable to update." exit 1 @@ -100,13 +100,20 @@ if [[ $newProjectName = 'exit' ]]; 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" 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/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 +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" +mv project_name/project_name.csproj.user "project_name/$newProjectName.csproj.user" mv project_name "$newProjectName" git init @@ -115,7 +122,4 @@ cd Nez.FNA git submodule init git submodule update -sleep 10 - -nuget restore Nez.FNA/Nez/Nez.sln -msbuild Nez.FNA/Nez/Nez.sln \ No newline at end of file +printf "\n\nManually run the following command:\n\nnuget restore Nez.FNA/Nez/Nez.sln && msbuild Nez.FNA/Nez/Nez.sln && msbuild /t:restore $newProjectName\n\n" diff --git a/project_name.code-workspace b/project_name.code-workspace new file mode 100644 index 0000000..a2a64fb --- /dev/null +++ b/project_name.code-workspace @@ -0,0 +1,14 @@ +{ + "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 new file mode 100644 index 0000000..7d9eda8 --- /dev/null +++ b/project_name.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +GlobalSection(SolutionConfigurationPlatforms) = preSolution +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 + {8C576ECC-147D-4B4A-8EC1-56533D26A178}.Debug|Any CPU.Build.0 = Debug|Any CPU + {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 + {11A5855C-B12C-4F8D-B935-56F3D0B671C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11A5855C-B12C-4F8D-B935-56F3D0B671C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + EndGlobalSection +EndGlobal diff --git a/project_name/.vscode/settings.json b/project_name/.vscode/settings.json index 6498dc9..ecc7cea 100644 --- a/project_name/.vscode/settings.json +++ b/project_name/.vscode/settings.json @@ -1,7 +1,7 @@ { // This prevents Omnisharp from prematurely creating obj and bin directories. // Change this to true after changing the name of the csproj file and running Restore Project. - "omnisharp.autoStart": false, + "omnisharp.autoStart": true, // This just circumvents annoying default behavior with the C# extension... // If you really like Code Lens, feel free to change this. @@ -12,6 +12,8 @@ "bin": true, "CompiledContent/bin": true, "CompiledContent/obj": true, - "CompiledContent/.mgstats": true + "CompiledContent/.mgstats": true, + "*.csproj.user": true, + "*.csproj": true } } \ No newline at end of file diff --git a/project_name/.vscode/tasks.json b/project_name/.vscode/tasks.json index 0993969..8fca028 100644 --- a/project_name/.vscode/tasks.json +++ b/project_name/.vscode/tasks.json @@ -112,5 +112,13 @@ }, "problemMatcher": "$msCompile" }, + + { + "label": "Open Pipeline Tool", + "type": "shell", + "group": "build", + "command": "export MONOGAME_PIPELINE_PROJECT=${workspaceFolder}/CompiledContent/Content.mgcb && /Applications/Pipeline.app/Contents/MacOS/Pipeline", + "problemMatcher": "$msCompile" + }, ] } \ No newline at end of file diff --git a/project_name/Game1.cs b/project_name/Game1.cs index 45c9beb..9c1c964 100644 --- a/project_name/Game1.cs +++ b/project_name/Game1.cs @@ -1,6 +1,4 @@ -using System; using Nez; -using Microsoft.Xna.Framework; namespace project_name { diff --git a/project_name/project_name.csproj b/project_name/project_name.csproj index 3c059fe..ef681d7 100644 --- a/project_name/project_name.csproj +++ b/project_name/project_name.csproj @@ -36,27 +36,26 @@ - - + x86\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + x64\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + osx\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + lib\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest - + lib64\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest diff --git a/project_name/project_name.csproj.user b/project_name/project_name.csproj.user new file mode 100644 index 0000000..68631cf --- /dev/null +++ b/project_name/project_name.csproj.user @@ -0,0 +1,7 @@ + + + + Project + false + + \ No newline at end of file diff --git a/project_name/project_name.sln b/project_name/project_name.sln new file mode 100644 index 0000000..8576363 --- /dev/null +++ b/project_name/project_name.sln @@ -0,0 +1,24 @@ + +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