From 5920d62e4d8fe0fc8cf5eff102b8216ab826b089 Mon Sep 17 00:00:00 2001 From: foxnne Date: Sat, 21 Sep 2019 20:12:30 -0500 Subject: [PATCH] hopefully fixed content builder errors --- .vscode/tasks.json | 48 ++++++++++++++++++++++- MonoGameContent.targets | 16 ++++---- getFNA.ps1 | 35 +++++++---------- project_name/CompiledContent/Content.mgcb | 29 ++++++++++++++ project_name/DefaultScene.cs | 2 +- project_name/project_name.csproj | 19 +++++++++ 6 files changed, 120 insertions(+), 29 deletions(-) create mode 100644 project_name/CompiledContent/Content.mgcb diff --git a/.vscode/tasks.json b/.vscode/tasks.json index dd1d1d2..693003f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -76,6 +76,7 @@ "command": "start", "args": [ "/wait", + "\"project_name.exe\"", //names the console window "${workspaceFolder}/project_name/bin/Debug/project_name.exe" ] }, @@ -94,7 +95,8 @@ "command": "start", "args": [ "/wait", - "${workspaceFolder}/project_name/bin/Release/project_name.exe" + "\"project_name.exe\"", //names the console window + "${workspaceFolder}/project_name/bin/Release/project_name.exe" ] }, "dependsOn": "Build (Release)", @@ -118,6 +120,50 @@ "problemMatcher": "$msCompile" }, + { + "label": "Build Content", + "type": "shell", + "group": "build", + "command": "msbuild /t:BuildContent", + "options": { + "cwd": "${workspaceFolder}/project_name" + }, + "problemMatcher": "$msCompile" + }, + + { + "label": "Force Build Content", + "type": "shell", + "group": "build", + "osx": { + "command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb -r", + }, + "windows": { + "command":"C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.exe", + "args": [ + "/@:Content.mgcb", + "-r" + ] + }, + "options": { + "cwd": "${workspaceFolder}/project_name/CompiledContent" + }, + "problemMatcher": "$msCompile" + }, + + { + "label": "Open Pipeline Tool", + "type": "shell", + "group": "build", + "osx": { + "command": "export MONOGAME_PIPELINE_PROJECT=${workspaceFolder}/project_name/CompiledContent/Content.mgcb && /Applications/Pipeline.app/Contents/MacOS/Pipeline" + }, + "windows": { + "command": "${workspaceFolder}/project_name/CompiledContent/Content.mgcb" + }, + "problemMatcher": "$msCompile" + }, + { "label": "Process T4 Templates", "type": "shell", diff --git a/MonoGameContent.targets b/MonoGameContent.targets index c5acfa8..5437823 100644 --- a/MonoGameContent.targets +++ b/MonoGameContent.targets @@ -11,6 +11,8 @@ Condition=" '$(OS)' != 'Windows_NT' And '$(MonoGameInstallDirectory)' == '' And Exists('/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/MonoGame.Common.props') ">/Library/Frameworks/Mono.framework/External/xbuild $(MSBuildProgramFiles32) + $(MonoGameInstallDir)Tools\MGCB.exe bin/DesktopGL obj/DesktopGL @@ -38,7 +40,7 @@ /usr/local/bin/mono /usr/bin/mono mono - $(MonoGameInstallDir)Tools\MGCB.exe + "$(MonoGameContentBuilderExe)" $(MonoExe) $(MonoGameContentBuilderCmd) $(MonoMacResourcePrefix) @@ -50,17 +52,17 @@
/platform:$(MonoGamePlatform)
+ + - - - diff --git a/getFNA.ps1 b/getFNA.ps1 index 162c762..bdd43bb 100644 --- a/getFNA.ps1 +++ b/getFNA.ps1 @@ -15,6 +15,21 @@ function checkDotnet() } } +function installT4 () +{ + if (checkDotnet) { Invoke-Expression 'dotnet tool install -g dotnet-t4' } +} + +function checkGit () +{ + try { git | Out-Null } + catch [System.Management.Automation.CommandNotFoundException] + { + Write-Output "ERROR: Git is not installed. Please install git to download FNA." + exit + } +} + function checkMsbuild () { try { msbuild | Out-Null } @@ -34,21 +49,6 @@ function check7zip () } } -function installT4 () -{ - if (checkDotnet) { Invoke-Expression 'dotnet tool install -g dotnet-t4' } -} - -function checkGit () -{ - try { git | Out-Null } - catch [System.Management.Automation.CommandNotFoundException] - { - Write-Output "ERROR: Git is not installed. Please install git to download FNA." - exit - } -} - function downloadFNA() { checkGit @@ -101,23 +101,19 @@ checkMsbuild if (Test-Path "${PSScriptRoot}\FNA") { - #if ((Read-Host -Prompt "Update FNA (y/n)?") -like 'y') { $shouldUpdate = true } $shouldUpdate = Read-Host -Prompt "Update FNA (y/n)?" } else { - #if ((Read-Host -Prompt "Download FNA (y/n)?") -like 'y') { $shouldDownload = true } $shouldDownload = Read-Host -Prompt "Download FNA (y/n)?" } if (Test-Path "${PSScriptRoot}\fnalibs") { - #if ((Read-Host -Prompt "Redownload fnalibs (y/n)?") -like 'y') { $shouldDownloadLibs = true } $shouldDownloadLibs = Read-Host -Prompt "Redownload fnalibs (y/n)?" } else { - #if ((Read-Host -Prompt "Download fnalibs (y/n)?") -like 'y') { $shouldDownloadLibs = true } $shouldDownloadLibs = Read-Host -Prompt "Download fnalibs (y/n)?" } @@ -177,5 +173,4 @@ dotnet restore "Nez/Nez.sln" "Building..." msbuild "Nez/Nez.sln" msbuild -t:restore $newProjectName -msbuild -t:buildcontent $newProjectName msbuild "${newProjectName}.sln" diff --git a/project_name/CompiledContent/Content.mgcb b/project_name/CompiledContent/Content.mgcb new file mode 100644 index 0000000..45c48e4 --- /dev/null +++ b/project_name/CompiledContent/Content.mgcb @@ -0,0 +1,29 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:DesktopGL +/config: +/profile:HiDef +/compress:False + +#-------------------------------- References --------------------------------# + +/reference:../../Nez/Nez.PipelineImporter/bin/Debug/Newtonsoft.Json.dll +/reference:../../Nez/Nez.PipelineImporter/bin/Debug/Nez.PipelineImporter.dll +/reference:../../Nez/Nez.PipelineImporter/bin/Debug/Nez.dll + +#---------------------------------- Content ---------------------------------# + +#begin nez-logo-black.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:nez-logo-black.png \ No newline at end of file diff --git a/project_name/DefaultScene.cs b/project_name/DefaultScene.cs index 2e1f3e1..3c5efa0 100644 --- a/project_name/DefaultScene.cs +++ b/project_name/DefaultScene.cs @@ -16,7 +16,7 @@ namespace project_name .AddComponent() .AddComponent(new PrototypeSprite(20, 20)); - var logo = Content.Load("nez-logo-black"); + var logo = Content.LoadTexture("Textures/nez-logo-black"); CreateEntity("logo") .SetPosition(Screen.Center) .AddComponent(new SpriteRenderer(logo)); diff --git a/project_name/project_name.csproj b/project_name/project_name.csproj index 8354c78..a797bdc 100644 --- a/project_name/project_name.csproj +++ b/project_name/project_name.csproj @@ -38,6 +38,25 @@ PreserveNewest + + + + + Content/%(RecursiveDir)%(Filename)%(Extension) + PreserveNewest + + + + + + + + + + + + + true