mirror of
https://github.com/prime31/FNA-VSCode-Template.git
synced 2025-10-31 21:50:44 +07:00
Removed PATH setting for msbuild and updated for PascalCase.
This commit is contained in:
parent
7af4093e67
commit
64673dbf49
103
getFNA.ps1
103
getFNA.ps1
@ -7,15 +7,30 @@
|
|||||||
# Checks if dotnet is installed
|
# Checks if dotnet is installed
|
||||||
function checkDotnet()
|
function checkDotnet()
|
||||||
{
|
{
|
||||||
try
|
try { dotnet | Out-Null }
|
||||||
{
|
|
||||||
dotnet | Out-Null
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
catch [System.Management.Automation.CommandNotFoundException]
|
catch [System.Management.Automation.CommandNotFoundException]
|
||||||
{
|
{
|
||||||
Write-Output "ERROR: Dotnet is not installed. Please install dotnet to download the t4 tool."
|
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}
|
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 ()
|
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
|
checkMsbuild
|
||||||
|
|
||||||
if (Test-Path "${PSScriptRoot}\FNA")
|
if (Test-Path "${PSScriptRoot}\FNA")
|
||||||
@ -225,9 +170,11 @@ Set-Location Nez
|
|||||||
git submodule init
|
git submodule init
|
||||||
git submodule update
|
git submodule update
|
||||||
|
|
||||||
"Restoring and rebuilding..."
|
"Restoring..."
|
||||||
Set-Location $PSScriptRoot
|
Set-Location $PSScriptRoot
|
||||||
dotnet restore "Nez/Nez.sln"
|
dotnet restore "Nez/Nez.sln"
|
||||||
|
|
||||||
|
"Building..."
|
||||||
msbuild "Nez/Nez.sln"
|
msbuild "Nez/Nez.sln"
|
||||||
msbuild -t:restore $newProjectName
|
msbuild -t:restore $newProjectName
|
||||||
msbuild -t:buildcontent $newProjectName
|
msbuild -t:buildcontent $newProjectName
|
||||||
|
|||||||
@ -7,21 +7,21 @@ namespace project_name
|
|||||||
{
|
{
|
||||||
public class DefaultScene : Scene
|
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")
|
CreateEntity("demo imgui draw commands")
|
||||||
.setPosition(new Vector2(150, 150))
|
.SetPosition(new Vector2(150, 150))
|
||||||
.addComponent<DemoComponent>()
|
.AddComponent<DemoComponent>()
|
||||||
.addComponent(new PrototypeSprite(20, 20));
|
.AddComponent(new PrototypeSprite(20, 20));
|
||||||
|
|
||||||
var logo = content.Load<Texture2D>("nez-logo-black");
|
var Logo = Content.Load<Texture2D>("nez-logo-black");
|
||||||
createEntity("logo")
|
CreateEntity("logo")
|
||||||
.setPosition(Screen.center)
|
.SetPosition(Screen.center)
|
||||||
.addComponent(new Nez.Sprites.Sprite(logo));
|
.AddComponent(new Nez.Sprites.Sprite(Logo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,31 +6,31 @@ namespace project_name
|
|||||||
{
|
{
|
||||||
public class DemoComponent : Component
|
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
|
// register with the ImGuiMangaer letting it know we want to render some IMGUI
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Core.getGlobalManager<ImGuiManager>().registerDrawCommand(imGuiDraw);
|
Core.GetGlobalManager<ImGuiManager>().RegisterDrawCommand(ImGuiDraw);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void onRemovedFromEntity()
|
public override void OnRemovedFromEntity()
|
||||||
{
|
{
|
||||||
// remove ourselves when we are removed from the Scene
|
// remove ourselves when we are removed from the Scene
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Core.getGlobalManager<ImGuiManager>().unregisterDrawCommand(imGuiDraw);
|
Core.GetGlobalManager<ImGuiManager>().UnregisterDrawCommand(ImGuiDraw);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void imGuiDraw()
|
void ImGuiDraw()
|
||||||
{
|
{
|
||||||
// do your actual drawing here
|
// 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");
|
ImGui.Text("This is being drawn in DemoComponent");
|
||||||
if (ImGui.Button($"Clicked me {_buttonClickCounter} times"))
|
if (ImGui.Button($"Clicked me {_ButtonClickCounter} times"))
|
||||||
_buttonClickCounter++;
|
_ButtonClickCounter++;
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,12 +17,10 @@ namespace project_name
|
|||||||
|
|
||||||
// render Nez in the imgui window in debug mode
|
// render Nez in the imgui window in debug mode
|
||||||
var imGuiManager = new ImGuiManager();
|
var imGuiManager = new ImGuiManager();
|
||||||
Core.registerGlobalManager(imGuiManager);
|
Core.RegisterGlobalManager(imGuiManager);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
scene = new DefaultScene();
|
Scene = new DefaultScene();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user