Files
MonoGame.Extended/source/MonoGame.Extended.Content.Pipeline/BitmapFonts/BitmapFontProcessor.cs
T
Christopher Whitley 8b3c2f0e1b Various fixes for the version 4 initial release (#915)
* Remove logging statement, not needed

* Add bmfont texture as dependency

* Remove existing instance check, this will always be null

* Fix BitmapFontContentReader

* Remove TODO comment
This was added 8 years ago, and I don't see any determinant to the states being global.

* Renamed `Refresh` to `Update`

* Added documentation comments

* file scoped namespace

* Remove unnecessary using

* Add file header

* Remove obsolete methods and update documentation

* file scoped namespace

* Remove TODO comment
The fields being static is fine.

* Renamed `Refersh` to `Update`

* Add documentation

* file scoped namespace

* Add documentation

* Remove deprecated methods
2024-07-09 15:22:33 -04:00

35 lines
1.1 KiB
C#

using System;
using System.IO;
using Microsoft.Xna.Framework.Content.Pipeline;
using MonoGame.Extended.Content.BitmapFonts;
namespace MonoGame.Extended.Content.Pipeline.BitmapFonts
{
[ContentProcessor(DisplayName = "BMFont Processor - MonoGame.Extended")]
public class BitmapFontProcessor : ContentProcessor<ContentImporterResult<BitmapFontFileContent>, BitmapFontProcessorResult>
{
public override BitmapFontProcessorResult Process(ContentImporterResult<BitmapFontFileContent> importerResult, ContentProcessorContext context)
{
try
{
BitmapFontFileContent bmfFile = importerResult.Data;
var result = new BitmapFontProcessorResult(bmfFile);
foreach (var page in bmfFile.Pages)
{
context.AddDependency(Path.GetFileName(page));
result.TextureAssets.Add(Path.GetFileNameWithoutExtension(page));
}
return result;
}
catch (Exception ex)
{
context.Logger.LogMessage("Error {0}", ex);
throw;
}
}
}
}