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"
|
||||
}
|
||||
|
||||
|
||||
4
.vscode/launch.json
vendored
4
.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)
|
||||
|
||||
"version": "0.2.0",
|
||||
@ -57,4 +57,4 @@
|
||||
"port": 55555
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
11
.vscode/tasks.json
vendored
11
.vscode/tasks.json
vendored
@ -49,7 +49,6 @@
|
||||
],
|
||||
"group": "build",
|
||||
"problemMatcher": "$msCompile",
|
||||
"dependsOn": "Build Content",
|
||||
},
|
||||
|
||||
{
|
||||
@ -77,6 +76,7 @@
|
||||
"command": "start",
|
||||
"args": [
|
||||
"/wait",
|
||||
"\"project_name.exe\"", //names the console window
|
||||
"${workspaceFolder}/project_name/bin/Debug/project_name.exe"
|
||||
]
|
||||
},
|
||||
@ -95,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,7 +119,7 @@
|
||||
},
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"label": "Build Content",
|
||||
"type": "shell",
|
||||
@ -162,7 +163,7 @@
|
||||
},
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"label": "Process T4 Templates",
|
||||
"type": "shell",
|
||||
@ -180,4 +181,4 @@
|
||||
"problemMatcher": "$msCompile",
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,16 +6,22 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<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
|
||||
Condition=" '$(MonoGameInstallDirectory)' == '' ">$(MSBuildProgramFiles32)</MonoGameInstallDirectory>
|
||||
<MonoGameContentBuilderExe
|
||||
Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDir)Tools\MGCB.exe</MonoGameContentBuilderExe>
|
||||
<ContentOutputDir>bin/DesktopGL</ContentOutputDir>
|
||||
<ContentIntermediateDir>obj/DesktopGL</ContentIntermediateDir>
|
||||
</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" />
|
||||
|
||||
|
||||
<!-- Add MonoGameContentReference to item type selection in Visual Studio -->
|
||||
<ItemGroup>
|
||||
<AvailableItemName Include="MonoGameContentReference" />
|
||||
@ -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/bin/mono') ">/usr/bin/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 Condition=" '$(OS)' != 'Windows_NT' ">$(MonoExe) $(MonoGameContentBuilderCmd)</MonoGameContentBuilderCmd>
|
||||
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'MacOSX'">$(MonoMacResourcePrefix)</PlatformResourcePrefix>
|
||||
@ -46,17 +52,17 @@
|
||||
<Header>/platform:$(MonoGamePlatform)</Header>
|
||||
</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 -->
|
||||
<!-- We do this here so we are compatible with xbuild -->
|
||||
<CollectContentReferences ContentReferences="@(MonoGameContentReference)" MonoGamePlatform="$(MonoGamePlatform)">
|
||||
<Output TaskParameter="Output" ItemName="ContentReferences" />
|
||||
</CollectContentReferences>
|
||||
|
||||
<Error
|
||||
Text="The MonoGame content builder executable could not be located at '$(MonoGameContentBuilderExe)'!"
|
||||
Condition="!Exists('$(MonoGameContentBuilderExe)')"
|
||||
/>
|
||||
|
||||
<Warning
|
||||
Text="No Content References Found. Please make sure your .mgcb file has a build action of MonoGameContentReference"
|
||||
Condition=" '%(ContentReferences.FullPath)' == '' "
|
||||
@ -81,7 +87,7 @@
|
||||
</CreateItem>
|
||||
</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)">
|
||||
<CreateItem Include="%(ExtraContent.FullPath)" AdditionalMetadata="Link=$(PlatformResourcePrefix)%(ExtraContent.ContentOutputDir)%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension);CopyToOutputDirectory=PreserveNewest"
|
||||
Condition="'%(ExtraContent.Filename)' != ''">
|
||||
|
||||
36
getFNA.ps1
36
getFNA.ps1
@ -11,6 +11,22 @@ function checkDotnet()
|
||||
catch [System.Management.Automation.CommandNotFoundException]
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
@ -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()
|
||||
{
|
||||
checkGit
|
||||
@ -101,23 +102,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 +174,4 @@ dotnet restore "Nez/Nez.sln"
|
||||
"Building..."
|
||||
msbuild "Nez/Nez.sln"
|
||||
msbuild -t:restore $newProjectName
|
||||
msbuild -t:buildcontent $newProjectName
|
||||
msbuild "${newProjectName}.sln"
|
||||
|
||||
@ -39,4 +39,4 @@ Global
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
EndGlobal
|
||||
|
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(new PrototypeSprite(20, 20));
|
||||
|
||||
var logo = Content.Load<Texture2D>("nez-logo-black");
|
||||
var logo = Content.LoadTexture("Textures/nez-logo-black");
|
||||
CreateEntity("logo")
|
||||
.SetPosition(Screen.Center)
|
||||
.AddComponent(new SpriteRenderer(logo));
|
||||
|
||||
9
project_name/DemoComponent.cs
Executable file → Normal file
9
project_name/DemoComponent.cs
Executable file → Normal file
@ -6,7 +6,7 @@ namespace project_name
|
||||
{
|
||||
public class DemoComponent : Component
|
||||
{
|
||||
int _buttonClickCounter;
|
||||
int _ButtonClickCounter;
|
||||
|
||||
public override void OnAddedToEntity()
|
||||
{
|
||||
@ -23,12 +23,13 @@ namespace project_name
|
||||
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"))
|
||||
_buttonClickCounter++;
|
||||
if (ImGui.Button($"Clicked me {_ButtonClickCounter} times"))
|
||||
_ButtonClickCounter++;
|
||||
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
@ -38,7 +38,7 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<!-- Include the CompiledContent bin (MGCB output). Copy it to the Content folder in the build. -->
|
||||
<ItemGroup>
|
||||
<Content Include="CompiledContent/bin/DesktopGL/**/*.xnb">
|
||||
@ -58,7 +58,6 @@
|
||||
|
||||
<Import Project="../MonoGameContent.targets"/>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user