mirror of
https://github.com/prime31/FNA-VSCode-Template.git
synced 2025-10-31 21:50:44 +07:00
Merge eef32d1784 into d50dcdf354
This commit is contained in:
commit
983ffe2b44
26
.vscode/buildEffects.ps1
vendored
Normal file
26
.vscode/buildEffects.ps1
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# buildEffects
|
||||||
|
# Compiles all .fx files found in the project's Content directory.
|
||||||
|
# Intended for usage with VS Code Build Tasks tooling.
|
||||||
|
# You may need to change the path to fxc.exe depending on your installation.
|
||||||
|
|
||||||
|
Write-Output "Starting build process..."
|
||||||
|
|
||||||
|
Set-Location $PSScriptRoot
|
||||||
|
Set-Location ../project_name
|
||||||
|
|
||||||
|
|
||||||
|
$fxc = "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe"
|
||||||
|
|
||||||
|
$files = Get-ChildItem -Path "Content\*" -Recurse -Include *fx
|
||||||
|
|
||||||
|
foreach ($file in $files)
|
||||||
|
{
|
||||||
|
$fileName = $file.BaseName
|
||||||
|
$filePath = $file.FullName
|
||||||
|
& $fxc /T fx_2_0 $filePath /Fo "${filePath}b"
|
||||||
|
|
||||||
|
Write-Output "Built ${fileName}.fx to ${filePath}b"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
// 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)
|
// (See: https://github.com/OmniSharp/omnisharp-vscode/wiki/Desktop-.NET-Framework)
|
||||||
|
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
|
|||||||
3
.vscode/tasks.json
vendored
3
.vscode/tasks.json
vendored
@ -49,7 +49,6 @@
|
|||||||
],
|
],
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"problemMatcher": "$msCompile",
|
"problemMatcher": "$msCompile",
|
||||||
"dependsOn": "Build Content",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -77,6 +76,7 @@
|
|||||||
"command": "start",
|
"command": "start",
|
||||||
"args": [
|
"args": [
|
||||||
"/wait",
|
"/wait",
|
||||||
|
"\"project_name.exe\"", //names the console window
|
||||||
"${workspaceFolder}/project_name/bin/Debug/project_name.exe"
|
"${workspaceFolder}/project_name/bin/Debug/project_name.exe"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -95,6 +95,7 @@
|
|||||||
"command": "start",
|
"command": "start",
|
||||||
"args": [
|
"args": [
|
||||||
"/wait",
|
"/wait",
|
||||||
|
"\"project_name.exe\"", //names the console window
|
||||||
"${workspaceFolder}/project_name/bin/Release/project_name.exe"
|
"${workspaceFolder}/project_name/bin/Release/project_name.exe"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,14 +6,20 @@
|
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<MonoGameInstallDirectory
|
<MonoGameInstallDirectory
|
||||||
Condition=" '$(MonoGameInstallDirectory)' == '' And Exists('/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/MonoGame.Common.props') ">/Library/Frameworks/Mono.framework/External/xbuild</MonoGameInstallDirectory>
|
Condition=" '$(OS)' == 'Windows_NT' And '$(MonoGameInstallDirectory)' == '' And Exists('C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Common.props') ">C:\Program Files (x86)\MSBuild</MonoGameInstallDirectory>
|
||||||
|
<MonoGameInstallDirectory
|
||||||
|
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</MonoGameInstallDirectory>
|
||||||
<MonoGameInstallDirectory
|
<MonoGameInstallDirectory
|
||||||
Condition=" '$(MonoGameInstallDirectory)' == '' ">$(MSBuildProgramFiles32)</MonoGameInstallDirectory>
|
Condition=" '$(MonoGameInstallDirectory)' == '' ">$(MSBuildProgramFiles32)</MonoGameInstallDirectory>
|
||||||
|
<MonoGameContentBuilderExe
|
||||||
|
Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDir)Tools\MGCB.exe</MonoGameContentBuilderExe>
|
||||||
<ContentOutputDir>bin/DesktopGL</ContentOutputDir>
|
<ContentOutputDir>bin/DesktopGL</ContentOutputDir>
|
||||||
<ContentIntermediateDir>obj/DesktopGL</ContentIntermediateDir>
|
<ContentIntermediateDir>obj/DesktopGL</ContentIntermediateDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<UsingTask TaskName="MonoGame.Build.Tasks.CollectContentReferences"
|
<UsingTask Condition=" '$(OS)' == 'Windows_NT' " TaskName="MonoGame.Build.Tasks.CollectContentReferences"
|
||||||
|
AssemblyFile="C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Build.Tasks.dll" />
|
||||||
|
<UsingTask Condition=" '$(OS)' != 'Windows_NT' " TaskName="MonoGame.Build.Tasks.CollectContentReferences"
|
||||||
AssemblyFile="\Library\Frameworks\MonoGame.framework\v3.0\MonoGame.Build.Tasks.dll" />
|
AssemblyFile="\Library\Frameworks\MonoGame.framework\v3.0\MonoGame.Build.Tasks.dll" />
|
||||||
|
|
||||||
<!-- Add MonoGameContentReference to item type selection in Visual Studio -->
|
<!-- Add MonoGameContentReference to item type selection in Visual Studio -->
|
||||||
@ -34,7 +40,7 @@
|
|||||||
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/local/bin/mono') ">/usr/local/bin/mono</MonoExe>
|
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/local/bin/mono') ">/usr/local/bin/mono</MonoExe>
|
||||||
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/bin/mono') ">/usr/bin/mono</MonoExe>
|
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/bin/mono') ">/usr/bin/mono</MonoExe>
|
||||||
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And '$(MonoExe)' == '' ">mono</MonoExe>
|
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And '$(MonoExe)' == '' ">mono</MonoExe>
|
||||||
<MonoGameContentBuilderExe Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDir)Tools\MGCB.exe</MonoGameContentBuilderExe>
|
<!-- <MonoGameContentBuilderExe Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDirectory)Tools\MGCB.exe</MonoGameContentBuilderExe> -->
|
||||||
<MonoGameContentBuilderCmd>"$(MonoGameContentBuilderExe)"</MonoGameContentBuilderCmd>
|
<MonoGameContentBuilderCmd>"$(MonoGameContentBuilderExe)"</MonoGameContentBuilderCmd>
|
||||||
<MonoGameContentBuilderCmd Condition=" '$(OS)' != 'Windows_NT' ">$(MonoExe) $(MonoGameContentBuilderCmd)</MonoGameContentBuilderCmd>
|
<MonoGameContentBuilderCmd Condition=" '$(OS)' != 'Windows_NT' ">$(MonoExe) $(MonoGameContentBuilderCmd)</MonoGameContentBuilderCmd>
|
||||||
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'MacOSX'">$(MonoMacResourcePrefix)</PlatformResourcePrefix>
|
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'MacOSX'">$(MonoMacResourcePrefix)</PlatformResourcePrefix>
|
||||||
@ -46,17 +52,17 @@
|
|||||||
<Header>/platform:$(MonoGamePlatform)</Header>
|
<Header>/platform:$(MonoGamePlatform)</Header>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Error
|
||||||
|
Text="The MonoGame content builder executable could not be located at '$(MonoGameContentBuilderExe)'!"
|
||||||
|
Condition="!Exists('$(MonoGameContentBuilderExe)')"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Get all Mono Game Content References and store them in a list -->
|
<!-- Get all Mono Game Content References and store them in a list -->
|
||||||
<!-- We do this here so we are compatible with xbuild -->
|
<!-- We do this here so we are compatible with xbuild -->
|
||||||
<CollectContentReferences ContentReferences="@(MonoGameContentReference)" MonoGamePlatform="$(MonoGamePlatform)">
|
<CollectContentReferences ContentReferences="@(MonoGameContentReference)" MonoGamePlatform="$(MonoGamePlatform)">
|
||||||
<Output TaskParameter="Output" ItemName="ContentReferences" />
|
<Output TaskParameter="Output" ItemName="ContentReferences" />
|
||||||
</CollectContentReferences>
|
</CollectContentReferences>
|
||||||
|
|
||||||
<Error
|
|
||||||
Text="The MonoGame content builder executable could not be located at '$(MonoGameContentBuilderExe)'!"
|
|
||||||
Condition="!Exists('$(MonoGameContentBuilderExe)')"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Warning
|
<Warning
|
||||||
Text="No Content References Found. Please make sure your .mgcb file has a build action of MonoGameContentReference"
|
Text="No Content References Found. Please make sure your .mgcb file has a build action of MonoGameContentReference"
|
||||||
Condition=" '%(ContentReferences.FullPath)' == '' "
|
Condition=" '%(ContentReferences.FullPath)' == '' "
|
||||||
@ -81,7 +87,7 @@
|
|||||||
</CreateItem>
|
</CreateItem>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder" AfterTargets="Build" Condition=" '@(MonoGameContentReference)' != '' "
|
<Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder" AfterTargets="Build" Condition=" '@(MonoGameContentReference)' != '' And Exists('$(MonoGameContentBuilderExe)')"
|
||||||
Outputs="%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)">
|
Outputs="%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)">
|
||||||
<CreateItem Include="%(ExtraContent.FullPath)" AdditionalMetadata="Link=$(PlatformResourcePrefix)%(ExtraContent.ContentOutputDir)%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension);CopyToOutputDirectory=PreserveNewest"
|
<CreateItem Include="%(ExtraContent.FullPath)" AdditionalMetadata="Link=$(PlatformResourcePrefix)%(ExtraContent.ContentOutputDir)%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension);CopyToOutputDirectory=PreserveNewest"
|
||||||
Condition="'%(ExtraContent.Filename)' != ''">
|
Condition="'%(ExtraContent.Filename)' != ''">
|
||||||
|
|||||||
36
getFNA.ps1
36
getFNA.ps1
@ -11,6 +11,22 @@ function checkDotnet()
|
|||||||
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;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,21 +50,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()
|
function downloadFNA()
|
||||||
{
|
{
|
||||||
checkGit
|
checkGit
|
||||||
@ -101,23 +102,19 @@ checkMsbuild
|
|||||||
|
|
||||||
if (Test-Path "${PSScriptRoot}\FNA")
|
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)?"
|
$shouldUpdate = Read-Host -Prompt "Update FNA (y/n)?"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if ((Read-Host -Prompt "Download FNA (y/n)?") -like 'y') { $shouldDownload = true }
|
|
||||||
$shouldDownload = Read-Host -Prompt "Download FNA (y/n)?"
|
$shouldDownload = Read-Host -Prompt "Download FNA (y/n)?"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path "${PSScriptRoot}\fnalibs")
|
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)?"
|
$shouldDownloadLibs = Read-Host -Prompt "Redownload fnalibs (y/n)?"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if ((Read-Host -Prompt "Download fnalibs (y/n)?") -like 'y') { $shouldDownloadLibs = true }
|
|
||||||
$shouldDownloadLibs = Read-Host -Prompt "Download fnalibs (y/n)?"
|
$shouldDownloadLibs = Read-Host -Prompt "Download fnalibs (y/n)?"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,5 +174,4 @@ dotnet restore "Nez/Nez.sln"
|
|||||||
"Building..."
|
"Building..."
|
||||||
msbuild "Nez/Nez.sln"
|
msbuild "Nez/Nez.sln"
|
||||||
msbuild -t:restore $newProjectName
|
msbuild -t:restore $newProjectName
|
||||||
msbuild -t:buildcontent $newProjectName
|
|
||||||
msbuild "${newProjectName}.sln"
|
msbuild "${newProjectName}.sln"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
2
project_name/DefaultScene.cs
Executable file → Normal file
2
project_name/DefaultScene.cs
Executable file → Normal file
@ -16,7 +16,7 @@ namespace project_name
|
|||||||
.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.LoadTexture("Textures/nez-logo-black");
|
||||||
CreateEntity("logo")
|
CreateEntity("logo")
|
||||||
.SetPosition(Screen.Center)
|
.SetPosition(Screen.Center)
|
||||||
.AddComponent(new SpriteRenderer(logo));
|
.AddComponent(new SpriteRenderer(logo));
|
||||||
|
|||||||
7
project_name/DemoComponent.cs
Executable file → Normal file
7
project_name/DemoComponent.cs
Executable file → Normal file
@ -6,7 +6,7 @@ namespace project_name
|
|||||||
{
|
{
|
||||||
public class DemoComponent : Component
|
public class DemoComponent : Component
|
||||||
{
|
{
|
||||||
int _buttonClickCounter;
|
int _ButtonClickCounter;
|
||||||
|
|
||||||
public override void OnAddedToEntity()
|
public override void OnAddedToEntity()
|
||||||
{
|
{
|
||||||
@ -25,10 +25,11 @@ namespace project_name
|
|||||||
// 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
project_name/Game1.cs
Executable file → Normal file
0
project_name/Game1.cs
Executable file → Normal file
0
project_name/T4Templates/ContentPathGenerator.tt
Executable file → Normal file
0
project_name/T4Templates/ContentPathGenerator.tt
Executable file → Normal file
@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
<Import Project="../MonoGameContent.targets"/>
|
<Import Project="../MonoGameContent.targets"/>
|
||||||
|
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user