diff --git a/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/.template.config/template.json b/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/.template.config/template.json new file mode 100644 index 0000000..e38cad7 --- /dev/null +++ b/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/.template.config/template.json @@ -0,0 +1,30 @@ +{ + "author": "MonoGame Foundation", + "classifications": [ + "MonoGame", "Games", "Extensions" + ], + "name": "MonoGame Content Pipeline Extension", + "groupIdentity": "MonoGame.Library.Pipeline.Item", + "identity": "MonoGame.Library.Pipeline.Extension.Item.CSharp", + "shortName": "mgpipelineitem", + "tags": { + "language": "C#", + "type": "item" + }, + "primaryOutputs": [ + { + "path": "MG-Importer.cs" + }, + { + "path": "MG-Processor.cs" + } + ], + "sourceName": "MG", + "symbols": { + "ItemName": { + "type": "parameter", + "replaceInFilename": true + } + }, + "description": "A MonoGame content pipeline extension item." +} diff --git a/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/MG-Importer.cs b/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/MG-Importer.cs new file mode 100644 index 0000000..d58655b --- /dev/null +++ b/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/MG-Importer.cs @@ -0,0 +1,12 @@ +using Microsoft.Xna.Framework.Content.Pipeline; + +using TImport = System.String; + +[ContentImporter(".txt", DisplayName = "MGImporter", DefaultProcessor = "MGProcessor")] +public class MGImporter : ContentImporter +{ + public override TImport Import(string filename, ContentImporterContext context) + { + return default(TImport); + } +} diff --git a/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/MG-Processor.cs b/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/MG-Processor.cs new file mode 100644 index 0000000..5fcb4f2 --- /dev/null +++ b/CSharp/content/MonoGame.ItemTemplate.Pipeline.Extension.CSharp/MG-Processor.cs @@ -0,0 +1,13 @@ +using Microsoft.Xna.Framework.Content.Pipeline; + +using TInput = System.String; +using TOutput = System.String; + +[ContentProcessor(DisplayName = "MGProcessor")] +public class MGProcessor : ContentProcessor +{ + public override TOutput Process(TInput input, ContentProcessorContext context) + { + return default(TOutput); + } +} diff --git a/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/.template.config/template.json b/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/.template.config/template.json new file mode 100644 index 0000000..b3f8924 --- /dev/null +++ b/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/.template.config/template.json @@ -0,0 +1,41 @@ +{ + "author": "MonoGame Foundation", + "classifications": [ + "MonoGame", "Games", "Content" + ], + "name": "MonoGame SpriteFont Template", + "groupIdentity": "MonoGame.ContentTemplate", + "identity": "MonoGame.SpriteFont.CSharp", + "shortName": "mgsf", + "tags": { + "language": "C#", + "type": "item" + }, + "primaryOutputs": [ + { + "path": "MGSpriteFont.spritefont" + } + ], + "sourceName": "MGSpriteFont", + "description": "A MonoGame SpriteFont item template for a Content Project.", + "symbols": { + "IncludeFont": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "description": "Include the default Roboto-Bold.ttf font file used in the template." + } + }, + "sources": [ + { + "modifiers": [ + { + "condition": "(!IncludeFont)", + "exclude": [ + "**/*.ttf" + ] + } + ] + } + ] +} diff --git a/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/MGSpriteFont.spritefont b/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/MGSpriteFont.spritefont new file mode 100644 index 0000000..5830b92 --- /dev/null +++ b/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/MGSpriteFont.spritefont @@ -0,0 +1,86 @@ + + + + + + + Roboto-Bold + + + 14 + + + 0 + + + true + + + + + + + + + + + + + þ + + + + + + + + + + + + + + + + + + + + + + + А + я + + + + diff --git a/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/Roboto-Bold.ttf b/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/Roboto-Bold.ttf new file mode 100644 index 0000000..e64db79 Binary files /dev/null and b/CSharp/content/MonoGame.ItemTemplate.SpriteFont.CSharp/Roboto-Bold.ttf differ diff --git a/README.md b/README.md index 731fe92..1f76c6f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,66 @@ # MonoGame.Templates -MonoGame repo to hold our project templates -# NOTE: -When creating your projects from these templates, using commands like `dotnet new mg2dstartkit -n {SomeName}` Do NOT use numbers as the 1st character of the name of your project. These will be replaced by underscores, `_`, and will break the templates. \ No newline at end of file +MonoGame repo to hold our project/item templates. + +## Project Templates + +> [!NOTE] +> +> When creating your projects from these templates, use commands like `dotnet new mg2dstartkit -n {SomeName}`. + +| Name | Short Code | Description | +| - | - | - | +| 2D StartKit | mg2dstartkit | A solution with a shared "Core" library and "Project" definitions for DesktopGL, iOS, and Android. | +| Blank 2D StartKit | mgblank2dstartkit | A complete solution, complete with content, with a shared "Core" library and "Project" definitions for DesktopGL, iOS, and Android. | +| Android | mgandroid | A blank Android MonoGame project | +| Cross-Platform desktop | mgdesktopgl | A blank Desktop GL MonoGame project | +| iOS | mgios | A blank iOS MonoGame project | +| Windows DirectX11 | mgwindowsdx | A blank Windows DX11 MonoGame project | +| Game Library | mglib | A blank MonoGame class library project, including MG references. | +| Content Builder Project | mgcb | A template Content Builder project, with default Builder script and Assets folder. | +| Content Pipeline Extension | mgpipeline | A template Content Pipeline Extension project. | + +> [!Note] +> Legacy Templates +> +> - Shared Library - mgshared - Legacy Xamarin template. + +## Preview Project Templates + +| Name | Short Code | Description | +| - | - | - | +| Content Builder StartKit | mg2dmgcbstartkit | Demo project complete with solution and content. Includes new VK/DX12 targets. | +| Content Builder Blank StartKit | mgblankmgcbstartkit | Demo solution without content. Includes new VK/DX12 targets. | + +## Rules for Project naming + +You **MUST** follow the standard .NET conventions when naming projects: + +- Do NOT use numbers as the 1st character of the name of your project. These will be replaced by underscores, `_`, and will break the templates. +- Do NOT begin with a special character +- Spaces are not allowed; they will be replaced with underscores, `_`, which will break the template. + +## Item Templates + +> [!NOTE] +> +> When creating your items from these templates, use commands like `dotnet new mgsf -n {SomeName}`. + +| Name | Short Code | Description | +| - | - | - | +| Sprite Font template | mgsf | SpriteFont item template for Content Projects | +| Content Pipeline Extension | mgpipelineitem | A template Content Pipeline Extension Item set (importer/processor) | + +> [!TIP] +> +> The SpriteFont template also includes a default Font file, to include it when creating an item, use the `--IncludeFont` argument. +> +> `dotnet new mgsf -n {SomeName} --IncludeFont` +> +> *Note this will error if the font file already exists in the directory. + +> [!TIP] +> We recommend when using the "Content Pipeline Extension" Item template, to also use the `-o` argument to place it in its own folder. Not mandatory. +> +> E.G. +> `dotnet new mgpipelineitem -n {SomeName} -o {SomeFolderName}`