Removed PATH setting for msbuild and updated for PascalCase.

This commit is contained in:
foxnne 2019-09-07 17:12:24 -05:00
parent 7af4093e67
commit 64673dbf49
4 changed files with 46 additions and 101 deletions

View File

@ -7,15 +7,30 @@
# Checks if dotnet is installed
function checkDotnet()
{
try
{
dotnet | Out-Null
return 1
}
try { dotnet | Out-Null }
catch [System.Management.Automation.CommandNotFoundException]
{
Write-Output "ERROR: Dotnet is not installed. Please install dotnet to download the t4 tool."
return 0
exit
}
}
function checkMsbuild ()
{
try { msbuild | Out-Null }
catch [System.Management.Automation.CommandNotFoundException]
{
Write-Output "ERROR: Msbuild is not available, please ensure msbuild.exe is installed and added to the PATH Environment Variable."
exit
}
}
function check7zip ()
{
if ((Test-Path "C:\Program Files\7-Zip") -eq 0)
{
Write-Output "ERROR: 7zip is not installed, please install 7zip and try again."
exit
}
}
@ -55,14 +70,7 @@ function updateFNA ()
else { Write-Output "ERROR: Unable to update." exit}
}
function check7zip ()
{
if ((Test-Path "C:\Program Files\7-Zip") -eq 0)
{
Write-Output "ERROR: 7zip is not installed, please install 7zip and try again."
exit
}
}
function getLibs ()
{
@ -89,69 +97,6 @@ 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")
@ -225,9 +170,11 @@ Set-Location Nez
git submodule init
git submodule update
"Restoring and rebuilding..."
"Restoring..."
Set-Location $PSScriptRoot
dotnet restore "Nez/Nez.sln"
"Building..."
msbuild "Nez/Nez.sln"
msbuild -t:restore $newProjectName
msbuild -t:buildcontent $newProjectName

View File

@ -7,21 +7,21 @@ namespace project_name
{
public class DefaultScene : Scene
{
public override void initialize()
public override void Initialize()
{
setDesignResolution(Screen.width, Screen.height, Scene.SceneResolutionPolicy.None);
SetDesignResolution(Screen.Width, Screen.Height, Scene.SceneResolutionPolicy.None);
addRenderer(new DefaultRenderer());
AddRenderer(new DefaultRenderer());
createEntity("demo imgui draw commands")
.setPosition(new Vector2(150, 150))
.addComponent<DemoComponent>()
.addComponent(new PrototypeSprite(20, 20));
CreateEntity("demo imgui draw commands")
.SetPosition(new Vector2(150, 150))
.AddComponent<DemoComponent>()
.AddComponent(new PrototypeSprite(20, 20));
var logo = content.Load<Texture2D>("nez-logo-black");
createEntity("logo")
.setPosition(Screen.center)
.addComponent(new Nez.Sprites.Sprite(logo));
var Logo = Content.Load<Texture2D>("nez-logo-black");
CreateEntity("logo")
.SetPosition(Screen.center)
.AddComponent(new Nez.Sprites.Sprite(Logo));
}
}
}

View File

@ -6,31 +6,31 @@ namespace project_name
{
public class DemoComponent : Component
{
int _buttonClickCounter;
int _ButtonClickCounter;
public override void onAddedToEntity()
public override void OnAddedToEntity()
{
// register with the ImGuiMangaer letting it know we want to render some IMGUI
#if DEBUG
Core.getGlobalManager<ImGuiManager>().registerDrawCommand(imGuiDraw);
Core.GetGlobalManager<ImGuiManager>().RegisterDrawCommand(ImGuiDraw);
#endif
}
public override void onRemovedFromEntity()
public override void OnRemovedFromEntity()
{
// remove ourselves when we are removed from the Scene
#if DEBUG
Core.getGlobalManager<ImGuiManager>().unregisterDrawCommand(imGuiDraw);
Core.GetGlobalManager<ImGuiManager>().UnregisterDrawCommand(ImGuiDraw);
#endif
}
void imGuiDraw()
void ImGuiDraw()
{
// do your actual drawing here
ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize);
ImGui.Text("This is being drawn in DemoComponent");
if (ImGui.Button($"Clicked me {_buttonClickCounter} times"))
_buttonClickCounter++;
if (ImGui.Button($"Clicked me {_ButtonClickCounter} times"))
_ButtonClickCounter++;
ImGui.End();
}

View File

@ -17,12 +17,10 @@ namespace project_name
// render Nez in the imgui window in debug mode
var imGuiManager = new ImGuiManager();
Core.registerGlobalManager(imGuiManager);
Core.RegisterGlobalManager(imGuiManager);
#endif
scene = new DefaultScene();
Scene = new DefaultScene();
}
}
}