BitmapFontImporter.cs 766 B

1234567891011121314151617
  1. using System.IO;
  2. using Microsoft.Xna.Framework.Content.Pipeline;
  3. using MonoGame.Extended.Content.BitmapFonts;
  4. namespace MonoGame.Extended.Content.Pipeline.BitmapFonts
  5. {
  6. [ContentImporter(".fnt", DefaultProcessor = "BitmapFontProcessor", DisplayName = "BMFont Importer - MonoGame.Extended")]
  7. public class BitmapFontImporter : ContentImporter<ContentImporterResult<BitmapFontFileContent>>
  8. {
  9. public override ContentImporterResult<BitmapFontFileContent> Import(string filename, ContentImporterContext context)
  10. {
  11. using FileStream stream = File.OpenRead(filename);
  12. var bmfFile = BitmapFontFileReader.Read(stream);
  13. return new ContentImporterResult<BitmapFontFileContent>(filename, bmfFile);
  14. }
  15. }
  16. }