Files
MonoGame.Extended/source/MonoGame.Extended.Content.Pipeline/BitmapFonts/BitmapFontProcessor.cs
T
Christopher Whitley 66277568c8 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
2024-06-11 00:25:10 -04:00

36 lines
1.2 KiB
C#

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<ContentImporterResult<BmfFile>, BitmapFontProcessorResult>
{
public override BitmapFontProcessorResult Process(ContentImporterResult<BmfFile> importerResult, ContentProcessorContext context)
{
try
{
BmfFile bmfFile = importerResult.Data;
context.Logger.LogMessage("Processing BMFont");
var result = new BitmapFontProcessorResult(bmfFile);
foreach (var fontPage in bmfFile.Pages)
{
var assetName = Path.GetFileNameWithoutExtension(fontPage);
context.Logger.LogMessage("Expected texture asset: {0}", assetName);
result.TextureAssets.Add(assetName);
}
return result;
}
catch (Exception ex)
{
context.Logger.LogMessage("Error {0}", ex);
throw;
}
}
}
}