Refactor BitmapFont (#887)

* Update file header

* Created initial project to move BitmapFont too

* XMl, Text, and Binar reading now supported for BMFont

* Refactor BittmapFont

* Update content pipeline from BitmapFont refactor

* Update changelog
This commit is contained in:
Christopher Whitley
2024-06-11 00:25:10 -04:00
committed by GitHub
parent 1f0235c605
commit 66277568c8
39 changed files with 1775 additions and 641 deletions
@@ -1,22 +1,24 @@
using System;
using System.IO;
using Microsoft.Xna.Framework.Content.Pipeline;
using MonoGame.Extended.BitmapFonts.BmfTypes;
namespace MonoGame.Extended.Content.Pipeline.BitmapFonts
{
[ContentProcessor(DisplayName = "BMFont Processor - MonoGame.Extended")]
public class BitmapFontProcessor : ContentProcessor<BitmapFontFile, BitmapFontProcessorResult>
public class BitmapFontProcessor : ContentProcessor<ContentImporterResult<BmfFile>, BitmapFontProcessorResult>
{
public override BitmapFontProcessorResult Process(BitmapFontFile bitmapFontFile, ContentProcessorContext context)
public override BitmapFontProcessorResult Process(ContentImporterResult<BmfFile> importerResult, ContentProcessorContext context)
{
try
{
BmfFile bmfFile = importerResult.Data;
context.Logger.LogMessage("Processing BMFont");
var result = new BitmapFontProcessorResult(bitmapFontFile);
var result = new BitmapFontProcessorResult(bmfFile);
foreach (var fontPage in bitmapFontFile.Pages)
foreach (var fontPage in bmfFile.Pages)
{
var assetName = Path.GetFileNameWithoutExtension(fontPage.File);
var assetName = Path.GetFileNameWithoutExtension(fontPage);
context.Logger.LogMessage("Expected texture asset: {0}", assetName);
result.TextureAssets.Add(assetName);
}
@@ -30,4 +32,4 @@ namespace MonoGame.Extended.Content.Pipeline.BitmapFonts
}
}
}
}
}