Skip to content

Commit

Permalink
Merge branch 'refs/heads/feature/template-overhaul' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Martenfur committed Dec 1, 2019
2 parents ba820bf + f56ba96 commit 3f6dcc0
Show file tree
Hide file tree
Showing 74 changed files with 1,300 additions and 1,132 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- Nopipeline's NPL config supports adding references with environment variables.
- Monofoxe is now able to launch on Android.
- Added an ability to change entity update order.
- Added an all-in-one multiplatform project template.
- Added various item templates.

### CHANGES:

Expand Down
32 changes: 22 additions & 10 deletions Installer/packInstaller.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
!define MUI_UNICON "pics\icon.ico"

!define NOPIPELINEROOT "..\NoPipeline\NoPipeline\NoPipeline\bin\Release"
!define TEMPLATES_DIRECTORY "Templates\ProjectTemplates\Visual C#\${APPNAME} ${APPVERSION}"
!define PROJECT_TEMPLATES_DIRECTORY "Templates\ProjectTemplates\Visual C#\${APPNAME} ${APPVERSION}"
!define ITEM_TEMPLATES_DIRECTORY "Templates\ItemTemplates\Visual C#\${APPNAME} ${APPVERSION}"


!define REGISTRY_DIRECTORY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME} ${APPVERSION}"

Expand Down Expand Up @@ -95,18 +97,24 @@ Section "MonoGame" Monogame
SectionEnd

Section "Visual Studio 2015 Templates/" VS2015
SetOutPath "$DOCUMENTS\Visual Studio 2015\${TEMPLATES_DIRECTORY}"
File /r '..\Release\*.zip'
SetOutPath "$DOCUMENTS\Visual Studio 2015\${PROJECT_TEMPLATES_DIRECTORY}"
File /r '..\Release\ProjectTemplates\*.zip'
SetOutPath "$DOCUMENTS\Visual Studio 2015\${ITEM_TEMPLATES_DIRECTORY}"
File /r '..\Release\ItemTemplates\*.zip'
SectionEnd

Section "Visual Studio 2017 Templates/" VS2017
SetOutPath "$DOCUMENTS\Visual Studio 2017\${TEMPLATES_DIRECTORY}"
File /r '..\Release\*.zip'
SetOutPath "$DOCUMENTS\Visual Studio 2017\${PROJECT_TEMPLATES_DIRECTORY}"
File /r '..\Release\ProjectTemplates\*.zip'
SetOutPath "$DOCUMENTS\Visual Studio 2017\${ITEM_TEMPLATES_DIRECTORY}"
File /r '..\Release\ItemTemplates\*.zip'
SectionEnd

Section "Visual Studio 2019 Templates/" VS2019
SetOutPath "$DOCUMENTS\Visual Studio 2019\${TEMPLATES_DIRECTORY}"
File /r '..\Release\*.zip'
SetOutPath "$DOCUMENTS\Visual Studio 2019\${PROJECT_TEMPLATES_DIRECTORY}"
File /r '..\Release\ProjectTemplates\*.zip'
SetOutPath "$DOCUMENTS\Visual Studio 2019\${ITEM_TEMPLATES_DIRECTORY}"
File /r '..\Release\ItemTemplates\*.zip'
SectionEnd

!define OldMonofoxeInstallationDir '$PROGRAMFILES\Monofoxe\'
Expand Down Expand Up @@ -180,9 +188,13 @@ FunctionEnd
; Uninstaller Section

Section "Uninstall"
RMDir /r "$DOCUMENTS\Visual Studio 2015\${TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2017\${TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2019\${TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2015\${PROJECT_TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2017\${PROJECT_TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2019\${PROJECT_TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2015\${ITEM_TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2017\${ITEM_TEMPLATES_DIRECTORY}"
RMDir /r "$DOCUMENTS\Visual Studio 2019\${ITEM_TEMPLATES_DIRECTORY}"

Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
DeleteRegKey HKLM "${REGISTRY_DIRECTORY}"
Expand Down
79 changes: 41 additions & 38 deletions PackRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,40 @@ Function Find-MsBuild([int] $MaxVersion = 2019)
}
$msbuild = Find-MsBuild

Function Assemble-Template([string] $platform, [bool] $copyCommon)
$projectTemplatesPath = "$PWD\Templates\ProjectTemplates\";
$itemTemplatesPath = "$PWD\Templates\ItemTemplates\";


Function Pack-Item-Template([string] $item)
{
"Packing $item..."
[IO.Compression.ZipFile]::CreateFromDirectory("$itemTemplatesPath$item", "$destItemTemplatesDir$item.zip")
}

Function Assemble-Template([string] $platform)
{
"Assembling templates for $platform..."
Copy-Item -path "$PWD\Templates\$platform\" -Destination "$destReleaseDir" -Recurse -Container
if ($copyCommon)
{
Copy-Item -path "$destCommonDir/*" -Destination "$destReleaseDir$platform" -Recurse -Container
New-Item -ItemType Directory -Force -Path "$destReleaseDir$platform\Content\Effects\" > $null
Copy-Item -path "$srcLibDir\*" -Filter "*.fx" -Destination "$destReleaseDir$platform\Content\Effects\"
}
Copy-Item -path "$PWD/Common/*" -Destination "$destReleaseDir$platform" -Recurse -Container
Copy-Item -path "$projectTemplatesPath$platform\" -Destination "$destProjectTemplatesDir" -Recurse -Container
Copy-Item -path "$PWD/Common/*" -Destination "$destProjectTemplatesDir$platform" -Recurse -Container

Copy-Item -path "$destProjectTemplatesDir$platform\" -Destination "$destProjectTemplatesDir$crossplatform\" -Recurse -Container

[IO.Compression.ZipFile]::CreateFromDirectory("$destProjectTemplatesDir$platform", "$destProjectTemplatesDir$platform.zip")
}

Add-Type -A System.IO.Compression.FileSystem

$debug = $TRUE
$debug = $FALSE

$srcLibDir = "$PWD\Monofoxe\bin\Release"

$destCommonDir = "$PWD\Templates\CommonFiles"
$destReleaseDir = "$PWD\Release\"
$destProjectTemplatesDir = "$destReleaseDir\ProjectTemplates\"
$destItemTemplatesDir = "$destReleaseDir\ItemTemplates\"

$crossplatform = "Crossplatform"

$desktopGL = "MonofoxeDesktopGL"
$blankDesktopGL = "MonofoxeDesktopGLBlank"
$blankWindows = "MonofoxeWindowsBlank"
$shared = "MonofoxeShared"
$library = "MonofoxeDotnetStandardLibrary"

"Building solution $msbuild..."
&$msbuild ("$PWD\Monofoxe\Monofoxe.sln" ,'/verbosity:q','/p:configuration=Release','/t:Clean,Build')
Expand All @@ -66,40 +73,36 @@ if (Test-Path "$destReleaseDir" -PathType Container)
Remove-Item "$destReleaseDir" -Force -Recurse
}
New-Item -ItemType Directory -Force -Path "$destReleaseDir" > $null
New-Item -ItemType Directory -Force -Path "$destProjectTemplatesDir" > $null
New-Item -ItemType Directory -Force -Path "$destItemTemplatesDir" > $null



Copy-Item -path "$projectTemplatesPath$crossplatform\" -Destination "$destProjectTemplatesDir" -Recurse -Container

Pack-Item-Template "Entity"
Pack-Item-Template "Component"
Pack-Item-Template "EntityTemplate"
Pack-Item-Template "TiledEntityFactory"
Pack-Item-Template "ResourceBox"

Assemble-Template $desktopGL $TRUE
Assemble-Template $blankDesktopGL $FALSE
Assemble-Template $blankWindows $FALSE
Assemble-Template $shared $TRUE
Assemble-Template $library $FALSE
Assemble-Template "GL"
Assemble-Template "DX"
Assemble-Template "MonofoxeDotnetStandardLibrary"
Assemble-Template "Shared"


"Packing templates..."
[IO.Compression.ZipFile]::CreateFromDirectory("$destReleaseDir$desktopGL", "$destReleaseDir$desktopGL.zip")
[IO.Compression.ZipFile]::CreateFromDirectory("$destReleaseDir$blankDesktopGL", "$destReleaseDir$blankDesktopGL.zip")
[IO.Compression.ZipFile]::CreateFromDirectory("$destReleaseDir$blankWindows", "$destReleaseDir$blankWindows.zip")
[IO.Compression.ZipFile]::CreateFromDirectory("$destReleaseDir$shared", "$destReleaseDir$shared.zip")
[IO.Compression.ZipFile]::CreateFromDirectory("$destReleaseDir$library", "$destReleaseDir$library.zip")
[IO.Compression.ZipFile]::CreateFromDirectory("$destProjectTemplatesDir$crossplatform", "$destProjectTemplatesDir$crossplatform.zip")


"Making installer..."
&makensis Installer/packInstaller.nsi

"Cleaning..."
if ($debug)
if (!$debug)
{
Remove-Item "$destReleaseDir$desktopGL" -Force -Recurse
Remove-Item "$destReleaseDir$blankDesktopGL" -Force -Recurse
Remove-Item "$destReleaseDir$blankWindows" -Force -Recurse
Remove-Item "$destReleaseDir$shared" -Force -Recurse
Remove-Item "$destReleaseDir$library" -Force -Recurse

Remove-Item "$destReleaseDir$desktopGL.zip" -Force -Recurse
Remove-Item "$destReleaseDir$blankDesktopGL.zip" -Force -Recurse
Remove-Item "$destReleaseDir$blankWindows.zip" -Force -Recurse
Remove-Item "$destReleaseDir$shared.zip" -Force -Recurse
Remove-Item "$destReleaseDir$library.zip" -Force -Recurse
Remove-Item "$destProjectTemplatesDir" -Force -Recurse
Remove-Item "$destItemTemplatesDir" -Force -Recurse
}

Read-Host -Prompt "Done! Press Enter to exit"
Expand Down
14 changes: 0 additions & 14 deletions Templates/CommonFiles/Content/Content.mgcb

This file was deleted.

46 changes: 46 additions & 0 deletions Templates/ItemTemplates/Component/Component.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Microsoft.Xna.Framework;
using Monofoxe.Engine.Drawing;
using Monofoxe.Engine.EC;
using Monofoxe.Engine.SceneSystem;
using Monofoxe.Engine.Utils;
using System;
using System.Collections.Generic;


namespace $rootnamespace$
{
public class $safeitemname$ : Component
{


public override void Initialize()
{

}


public override void FixedUpdate()
{

}


public override void Update()
{

}


public override void Draw()
{

}


public override void Destroy()
{

}

}
}
15 changes: 15 additions & 0 deletions Templates/ItemTemplates/Component/Component.vstemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<Name>Monofoxe Component</Name>
<Description>A component class for Monofoxe Engine.</Description>
<ProjectType>CSharp</ProjectType>
<DefaultName>Component.cs</DefaultName>
<Icon>__TemplateIcon.png</Icon>
<TemplateID>Monofoxe.Component</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem SubType="" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Component.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
Binary file added Templates/ItemTemplates/Component/__TemplateIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions Templates/ItemTemplates/Entity/Entity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Microsoft.Xna.Framework;
using Monofoxe.Engine.Drawing;
using Monofoxe.Engine.EC;
using Monofoxe.Engine.SceneSystem;
using Monofoxe.Engine.Utils;
using System;
using System.Collections.Generic;


namespace $rootnamespace$
{
public class $safeitemname$ : Entity
{


public $safeitemname$(Layer layer) : base(layer)
{

}


public override void FixedUpdate()
{
base.FixedUpdate();


}


public override void Update()
{
base.Update();


}


public override void Draw()
{
base.Draw();


}


public override void Destroy()
{
base.Destroy();


}

}
}
15 changes: 15 additions & 0 deletions Templates/ItemTemplates/Entity/Entity.vstemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<Name>Monofoxe Entity</Name>
<Description>An entity class for Monofoxe Engine.</Description>
<ProjectType>CSharp</ProjectType>
<DefaultName>Entity.cs</DefaultName>
<Icon>__TemplateIcon.png</Icon>
<TemplateID>Monofoxe.Entity</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem SubType="" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Entity.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
Binary file added Templates/ItemTemplates/Entity/__TemplateIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Templates/ItemTemplates/EntityTemplate/EntityTemplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.Xna.Framework;
using Monofoxe.Engine.Drawing;
using Monofoxe.Engine.EC;
using Monofoxe.Engine.SceneSystem;
using Monofoxe.Engine.Utils;
using System;
using System.Collections.Generic;

namespace $rootnamespace$
{
public class $safeitemname$ : IEntityTemplate
{
public string Tag => "$itemname$";

public Entity Make(Layer layer)
{


return null;
}
}
}
15 changes: 15 additions & 0 deletions Templates/ItemTemplates/EntityTemplate/EntityTemplate.vstemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<Name>Monofoxe Entity Template</Name>
<Description>An entity template class for Monofoxe Engine.</Description>
<ProjectType>CSharp</ProjectType>
<DefaultName>EntityTemplate.cs</DefaultName>
<Icon>__TemplateIcon.png</Icon>
<TemplateID>Monofoxe.EntityTemplate</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem SubType="" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">EntityTemplate.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3f6dcc0

Please sign in to comment.