From 3e5a7e6a78474d0cd896ab828951caf7dc499cab Mon Sep 17 00:00:00 2001 From: foxnne Date: Mon, 2 Sep 2019 17:49:21 -0500 Subject: [PATCH] Nearly finalized, added back all the osx compatibility. Hopefully this now works with both OSX and Windows... I tried to create platform specific properties everywhere I could. All Windows build tasks for VSCode seem to be working correctly now. --- .vscode/buildEffects.ps1 | 2 +- .vscode/launch.json | 42 ++++++-- .vscode/settings.json | 1 + .vscode/tasks.json | 43 +++++--- MonoGameContent.targets | 10 +- MonoGameContent.targets.bak | 93 ----------------- README.md | 8 +- getFNA.ps1 | 76 ++++++++++++-- getFNA.sh | 171 +++++++++++++++++++++++++++++++ project_name.sln | 13 ++- project_name/DemoComponent.cs | 11 +- project_name/Game1.cs | 8 +- project_name/project_name.csproj | 1 + 13 files changed, 345 insertions(+), 134 deletions(-) delete mode 100644 MonoGameContent.targets.bak create mode 100644 getFNA.sh diff --git a/.vscode/buildEffects.ps1 b/.vscode/buildEffects.ps1 index 23bf379..0f5a719 100644 --- a/.vscode/buildEffects.ps1 +++ b/.vscode/buildEffects.ps1 @@ -10,7 +10,7 @@ Set-Location ../project_name $fxc = "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" -$files = Get-ChildItem -Path "Content\*" -Include *fx +$files = Get-ChildItem -Path "Content\*" -Recurse -Include *fx foreach ($file in $files) { diff --git a/.vscode/launch.json b/.vscode/launch.json index de33671..3587b54 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,16 +1,44 @@ { - // Change "mono" to "clr" for 64-bit .NET Framework debugging on Windows. + // Delete unnecessary configurations if unneeded. "type" isnt supported for platform specifc properties. // (See: https://github.com/OmniSharp/omnisharp-vscode/wiki/Desktop-.NET-Framework) "version": "0.2.0", "configurations": [ + { - "name": "Launch", + "name": "Launch (Mac)", "type": "mono", "request": "launch", "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "cwd": "${workspaceFolder}/project_name", "preLaunchTask": "Build (Debug)", + "osx":{ + "env": { + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" + }, + }, + }, + + { + "name": "Launch Without Building (Mac)", + "type": "mono", + "request": "launch", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", + "cwd": "${workspaceFolder}", + "osx":{ + "env": { + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" + }, + } + }, + + { + "name": "Launch (Windows)", + "type": "clr", + "request": "launch", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", + "cwd": "${workspaceFolder}/project_name", + "preLaunchTask": "Build (Debug)", "osx":{ "env": { "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" @@ -19,14 +47,14 @@ }, { - "name": "Launch Without Building", - "type": "mono", + "name": "Launch Without Building (Windows)", + "type": "clr", "request": "launch", - "program": "${workspaceFolder}/Fook/bin/Debug/Fook.exe", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "cwd": "${workspaceFolder}", "osx":{ "env": { - "DYLD_LIBRARY_PATH": "${workspaceFolder}/Fook/bin/Debug/osx/" + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" }, } }, @@ -39,4 +67,4 @@ "port": 55555 } ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 2882144..d6d3a8c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "**/.[^v]*": true, // hide any files that start with a '.' but keep the .vscode folder ".vs": true, // Visual Studio settings "getFNA.sh": true, + "getFNA.ps1": true, "imgui.ini": true, "MonoGameContent.targets": true, "**/obj": true, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 718ba17..851db23 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -52,7 +52,6 @@ "dependsOn": "Build Content", }, - //Confused how release works with this template by default, no release config seems to be setup in the sln { "label": "Build (Release)", "type": "shell", @@ -75,9 +74,10 @@ "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/project_name/bin/Debug/osx/ mono ${workspaceFolder}/project_name/bin/Debug/project_name.exe" }, "windows":{ - "command": "cmd", + "command": "start", "args": [ - "/k", + "/wait", + "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "${workspaceFolder}/project_name/bin/Debug/project_name.exe" ] }, @@ -93,9 +93,10 @@ "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/project_name/bin/Release/osx/ mono ${workspaceFolder}/project_name/bin/Release/project_name.exe" }, "windows":{ - "command": "cmd", + "command": "start", "args": [ - "/k", + "/wait", + "${workspaceFolder}/project_name/bin/Release/project_name.exe", "${workspaceFolder}/project_name/bin/Release/project_name.exe" ] }, @@ -108,7 +109,7 @@ "type": "shell", "group": "build", "osx":{ - "command": "${workspaceFolder}/.vscode/buildEffects.ps1" + "command": "${workspaceFolder}/.vscode/buildEffects.sh" }, "windows":{ "command": "& ${workspaceFolder}/.vscode/buildEffects.ps1" @@ -127,30 +128,48 @@ "problemMatcher": "$msCompile" }, - //I dont fully understand this function or how to replicate on windows. - /* { + { "label": "Force Build Content", "type": "shell", "group": "build", - "command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb -r", + "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", - "command": "${workspaceFolder}/lucid/CompiledContent/Content.mgcb", + "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", - "command": "${workspaceFolder}/.vscode/processT4Templates.ps1", + "osx": { + "command": "${workspaceFolder}/.vscode/processT4Templates.sh" + }, + "windows": { + "command": "& ${workspaceFolder}/.vscode/processT4Templates.ps1" + }, "group": "build", "problemMatcher": "$msCompile", }, diff --git a/MonoGameContent.targets b/MonoGameContent.targets index 9978756..c5acfa8 100644 --- a/MonoGameContent.targets +++ b/MonoGameContent.targets @@ -6,16 +6,20 @@ C:\Program Files (x86)\MSBuild + Condition=" '$(OS)' == 'Windows_NT' And '$(MonoGameInstallDirectory)' == '' And Exists('C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Common.props') ">C:\Program Files (x86)\MSBuild + /Library/Frameworks/Mono.framework/External/xbuild $(MSBuildProgramFiles32) bin/DesktopGL obj/DesktopGL - - + + diff --git a/MonoGameContent.targets.bak b/MonoGameContent.targets.bak deleted file mode 100644 index fa00c36..0000000 --- a/MonoGameContent.targets.bak +++ /dev/null @@ -1,93 +0,0 @@ - - - - /Library/Frameworks/Mono.framework/External/xbuild - $(MSBuildProgramFiles32) - bin/DesktopGL - obj/DesktopGL - - - - - - - - - - - - true - - - - - $(MonoGameInstallDirectory)\MonoGame\v3.0\ - - /Library/Frameworks/Mono.framework/Versions/Current/bin/mono - /usr/local/bin/mono - /usr/bin/mono - mono - $(MonoGameInstallDir)Tools\MGCB.exe - "$(MonoGameContentBuilderExe)" - $(MonoExe) $(MonoGameContentBuilderCmd) - $(MonoMacResourcePrefix) - $(IPhoneResourcePrefix) - $(MonoAndroidAssetsPrefix) - $(PlatformResourcePrefix)\ - - /quiet -
/platform:$(MonoGamePlatform)
-
- - - - - - - - - - -
- - - - - BuildContent; - $(BuildDependsOn); - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/README.md b/README.md index 581d540..578d12f 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,18 @@ Start new FNA projects with Nez quickly and easily with handy setup scripts, a v ## Prerequisites ## -- [Visual Studio Code](https://code.visualstudio.com) or [Visual Studio](https://visualstudio.microsoft.com/) (recommended to use Visual Studio Code because it has some custom tasks but either will work fine) - - [Mono Debugger Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.mono-debug) (required for macOS debugging) +- [Visual Studio Code](https://code.visualstudio.com) or [Visual Studio](https://visualstudio.microsoft.com/) (recommended to use Visual Studio Code because it has some custom tasks but either will work fine.) +- [Mono Debugger Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.mono-debug) (required for macOS debugging) - [MonoGame](http://www.monogame.net/downloads/) (required for compiling content with the Pipeline tool) - (optional) [.NET Core](https://dotnet.microsoft.com/download) (required for compiling T4 templates) - (optional) [Microsoft DirectX SDK (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=6812) (required for building effects, [you can use Wine to run this](https://github.com/AndrewRussellNet/FNA-Template#linuxmacos-installing-the-directx-sdk-on-wine)) +- (windows only) [7zip](https://www.7-zip.org) (if intending to use fnalibs, the filetype is unsupported for windows and requires 7zip to be installed to decompress/unzip) +- (windows only) [Build tools for Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16)(these build tools are required for all Visual Studio Code build tasks. if you intend to use the full Visual Studio, these are already included. be sure to include .NET Core Build Tools in the installation) ## 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. +2. Run `./getFNA.sh` (macOS) or `./getFNA.ps1` (windows) 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. 3. Open the root folder that contains the .sln file in Visual Studio Code or the .sln file directly in Visual Studio. Note that only Visual Studio Code has an effect builder command. That's it! Now you're ready to build and run the base project. If you get missing DLL errors (pointing at SDL) when running in Visual Studio copy the FNA libs into your `/usr/local/lib` folder. With Visual Studio Code, `DYLD_LIBRARY_PATH` is set automatically so it won't run into the DLL not found error. Nez is setup as a submodule so you can update it in the normal fashion. diff --git a/getFNA.ps1 b/getFNA.ps1 index 46eee3a..cb8288f 100644 --- a/getFNA.ps1 +++ b/getFNA.ps1 @@ -57,13 +57,9 @@ function updateFNA () function check7zip () { - try + if ((Test-Path "C:\Program Files\7-Zip") -eq 0) { - 7z | Out-Null - } - catch [System.Management.Automation.CommandNotFoundException] - { - Write-Output "ERROR: 7Zip is not installed. Please install 7Zip and set PATH Environment Variable and try again." + Write-Output "ERROR: 7zip is not installed, please install 7zip and try again." exit } } @@ -79,10 +75,10 @@ function getLibs () check7zip if ((Test-Path "${PSScriptRoot}\fnalibs") -eq 0) { - 7z x "fnalibs.tar.bz2" + & "C:\Program Files\7-Zip\7z.exe" x "fnalibs.tar.bz2" if ($? -eq 1){ Remove-Item "fnalibs.tar.bz2"} else { Write-Output "ERROR: Unable to decompress successfully." exit } - 7z x "fnalibs.tar" -ofnalibs + & "C:\Program Files\7-Zip\7z.exe" x "fnalibs.tar" -ofnalibs if ($? -eq 1) { Remove-Item "fnalibs.tar" @@ -93,6 +89,70 @@ function getLibs () } +function checkMsbuild () +{ + try { msbuild | Out-Null } + catch [System.Management.Automation.CommandNotFoundException] + { + Write-Output "ERROR: 'msbuild' is not available. Attempting to look for build tools..." + if ((Test-Path "C:\Program Files (x86)\Microsoft Visual Studio") -eq 1) + { + $files = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\*" -Recurse -Include "msbuild.exe" | Where-Object { (Split-Path (Split-Path $_.FullName -Parent) -Leaf) -like 'bin'} + if ($files.Length -gt 0) + { + if ($files.Length -gt 1) + { + Write-Output "Found multiple build tools... unsure which version to use." + for ($i = 0; $i -lt $files.Length; $i++) + { + $filename = $files[$i].FullName + $c = $i + 1 + Write-Output "${c}: ${filename}" + } + $max = $files.Length + $choice = Read-Host -Prompt "Choose desired msbuild version? (1-${max})" + if ($choice -le 0 -or $choice -gt $files.Length+1) + { + "ERROR: invalid choice, exiting" + } + + $msbuildpath = Split-Path $files[$choice-1].FullName + Write-Output "your choice was ${choice} which equals this path: ${msbuildpath}. attempting to add to PATH..." + + [Environment]::SetEnvironmentVariable("Path", $env:Path + $msbuildpath, "Machine") + + Write-Output "Close and run getFNA.ps1 again..." + exit + + } + else + { + Write-Output "Found build tools, attempting to add to PATH..." + $msbuildpath = Split-Path $files[0].FullName + + [Environment]::SetEnvironmentVariable("Path", $env:Path + $msbuildpath, "Machine") + + Write-Output "Close and run getFNA.ps1 again..." + exit + } + } + else + { + Write-Output "ERROR: Build tools for Visual Studio not installed or installed in an unknown location." + Write-Output "If you know they are installed somewhere else, please create a PATH Environment Variable for them and retry." + exit + } + } + else + { + Write-Output "ERROR: Build tools for Visual Studio not installed or installed in an unknown location." + Write-Output "If you know they are installed somewhere else, please create a PATH Environment Variable for them and retry." + exit + } + } +} + +checkMsbuild if (Test-Path "${PSScriptRoot}\FNA") { diff --git a/getFNA.sh b/getFNA.sh new file mode 100644 index 0000000..9ba3ce4 --- /dev/null +++ b/getFNA.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# Program: getFNA +# Author: Caleb Cornett +# Usage: ./getFNA.sh +# Description: Quick and easy way to install a local copy of FNA and its native libraries. + +# Checks if dotnet is installed +function checkDotnet() +{ + # || { echo >&2 "ERROR: dotnet is not installed. Please install dotnet to download the t4 tool."; exit 1; } + command -v dotnet > /dev/null 2>&1 + if [ ! $? -eq 0 ]; then + echo >&2 "ERROR: dotnet is not installed. Please install dotnet to download the t4 tool." + exit 1 + fi +} + +# Checks if t4 is installed and installs it if it isnt +function installT4() +{ + checkDotnet + command -v t4 > /dev/null 2>&1 + if [ ! $? -eq 0 ]; then + dotnet tool install -g dotnet-t4 + fi +} + +# Checks if git is installed +function checkGit() +{ + git --version > /dev/null 2>&1 + if [ ! $? -eq 0 ]; then + echo >&2 "ERROR: Git is not installed. Please install git to download FNA." + exit 1 + fi +} + +# Clones FNA from the git master branch +function downloadFNA() +{ + checkGit + echo "Downloading FNA..." + git -C $MY_DIR clone https://github.com/FNA-XNA/FNA.git --recursive + if [ $? -eq 0 ]; then + echo "Finished downloading!" + else + echo >&2 "ERROR: Unable to download successfully. Maybe try again later?" + fi +} + +# Pulls FNA from the git master branch +function updateFNA() +{ + checkGit + echo "Updating to the latest git version of FNA..." + git -C "$MY_DIR/FNA" pull --recurse-submodules + if [ $? -eq 0 ]; then + echo "Finished updating!" + else + echo >&2 "ERROR: Unable to update." + exit 1 + fi +} + + +# Downloads and extracts prepackaged archive of native libraries ("fnalibs") +function getLibs() +{ + # Downloading + echo "Downloading latest fnalibs..." + curl http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 > "$MY_DIR/fnalibs.tar.bz2" + if [ $? -eq 0 ]; then + echo "Finished downloading!" + else + >&2 echo "ERROR: Unable to download successfully." + exit 1 + fi + + # Decompressing + echo "Decompressing fnalibs..." + mkdir -p $MY_DIR/fnalibs + tar xjC $MY_DIR/fnalibs -f $MY_DIR/fnalibs.tar.bz2 + if [ $? -eq 0 ]; then + echo "Finished decompressing!" + echo "" + rm $MY_DIR/fnalibs.tar.bz2 + else + >&2 echo "ERROR: Unable to decompress successfully." + exit 1 + fi +} + +# Get the directory of this script +MY_DIR=$(dirname "$BASH_SOURCE") + + +# gather input + +# FNA +if [ ! -d "$MY_DIR/FNA" ]; then + read -p "Download FNA (y/n)? " shouldDownload +else + read -p "Update FNA (y/n)? " shouldUpdate +fi + +if [ ! -d "$MY_DIR/fnalibs" ]; then + read -p "Download fnalibs (y/n)? " shouldDownloadLibs +else + read -p "Redownload fnalibs (y/n)? " shouldDownloadLibs +fi + + +# act on the input + +# FNA +if [[ $shouldDownload =~ ^[Yy]$ ]]; then + downloadFNA +elif [[ $shouldUpdate =~ ^[Yy]$ ]]; then + updateFNA +fi + +# FNALIBS +if [[ $shouldDownloadLibs =~ ^[Yy]$ ]]; then + getLibs +fi + + +# install t4 engine +installT4 + + + +# Only proceed from here if we have not yet renamed the project +if [ ! -d "$MY_DIR/project_name" ]; then + # old project_name folder already renamed so we are all done here + exit 1 +fi + + +read -p "Enter the project name to use for your folder and csproj file or 'exit' to quit: " newProjectName +if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then + exit 1 +fi + +# any files that need to have project_name replaced with the new project name should be here +files=(project_name.sln .gitignore project_name/project_name.csproj project_name/Game1.cs project_name/DemoComponent.cs project_name/DefaultScene.cs project_name/Program.cs .vscode/tasks.json .vscode/settings.json .vscode/launch.json .vscode/buildEffects.sh .vscode/processT4Templates.sh) +for file in "${files[@]}"; do + sed -i '' "s/project_name/$newProjectName/g" $file +done + +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 +git submodule add https://github.com/prime31/Nez.git +cd Nez +git submodule init +git submodule update + +command -v pbcopy > /dev/null 2>&1 +if [ ! $? -eq 0 ]; then + printf "\n\nManually run the following command:\n\nnuget restore Nez/Nez.sln && msbuild Nez/Nez.sln && msbuild /t:restore $newProjectName && msbuild $newProjectName.sln\n\n" +else + echo "nuget restore Nez/Nez.sln && msbuild Nez/Nez.sln && msbuild /t:restore $newProjectName && msbuild $newProjectName.sln" | pbcopy + echo "" + echo "A build command was copied to your clipboard. Paste and run it now." + echo "" +fi diff --git a/project_name.sln b/project_name.sln index c956a2f..7720695 100644 --- a/project_name.sln +++ b/project_name.sln @@ -24,8 +24,19 @@ Global {16DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Debug|Any CPU.Build.0 = Debug|Any CPU {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CB9E917-FEF7-453F-A88D-6B85B552B058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CB9E917-FEF7-453F-A88D-6B85B552B058}.Release|Any CPU.Build.0 = Release|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 + {11A5855C-B12C-4F8D-B935-56F3D0B671C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11A5855C-B12C-4F8D-B935-56F3D0B671C3}.Release|Any CPU.Build.0 = Release|Any CPU + {16DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.Build.0 = Release|Any CPU + {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/project_name/DemoComponent.cs b/project_name/DemoComponent.cs index cceb7c0..1618b49 100644 --- a/project_name/DemoComponent.cs +++ b/project_name/DemoComponent.cs @@ -2,7 +2,7 @@ using ImGuiNET; using Nez; using Nez.ImGuiTools; -namespace project_name +namespace lucid { public class DemoComponent : Component { @@ -11,24 +11,29 @@ namespace project_name public override void onAddedToEntity() { // register with the ImGuiMangaer letting it know we want to render some IMGUI +#if DEBUG Core.getGlobalManager().registerDrawCommand(imGuiDraw); +#endif } public override void onRemovedFromEntity() { // remove ourselves when we are removed from the Scene +#if DEBUG Core.getGlobalManager().unregisterDrawCommand(imGuiDraw); +#endif } void imGuiDraw() { // do your actual drawing here - ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize); + ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text("This is being drawn in DemoComponent"); - if(ImGui.Button($"Clicked me {_buttonClickCounter} times")) + if (ImGui.Button($"Clicked me {_buttonClickCounter} times")) _buttonClickCounter++; ImGui.End(); } } } + diff --git a/project_name/Game1.cs b/project_name/Game1.cs index 37a9350..08f0cb5 100644 --- a/project_name/Game1.cs +++ b/project_name/Game1.cs @@ -14,13 +14,15 @@ namespace project_name #if DEBUG System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out)); + + // render Nez in the imgui window in debug mode + var imGuiManager = new ImGuiManager(); + Core.registerGlobalManager(imGuiManager); #endif scene = new DefaultScene(); - // optionally render Nez in an ImGui window - var imGuiManager = new ImGuiManager(); - Core.registerGlobalManager(imGuiManager); + } } } \ No newline at end of file diff --git a/project_name/project_name.csproj b/project_name/project_name.csproj index e6bd126..b384478 100644 --- a/project_name/project_name.csproj +++ b/project_name/project_name.csproj @@ -8,6 +8,7 @@ project_name DesktopGL True + false