【问题标题】:SpriteFont not working with MonoGameSpriteFont 不适用于 MonoGame
【发布时间】:2015-07-10 00:50:34
【问题描述】:
font = Content.Load<SpriteFont>("TopBarFont");

无论出于何种原因,无论发生什么或我更改了什么,我总是会收到此错误。

An unhandled exception of type 'System.NotImplementedException' occurred in MonoGame.Framework.dll Additional information: The method or operation is not implemented.

我将内容文件夹中的 TopBarFont.spritefont 设置为内容,并始终像我的所有其他资产一样复制到输出目录。

我的 spritefont 文件是这样的,

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
    <Asset Type="Graphics:FontDescription">
        <FontName>Open Sans Light</FontName>
        <Size>36</Size>
        <Spacing>0</Spacing>
        <UseKerning>true</UseKerning>
        <Style>Regular</Style>
        <CharacterRegions>
            <CharacterRegion>
                <Start>&#32;</Start>
                <End>&#126;</End>
            </CharacterRegion>
        </CharacterRegions>
    </Asset>
</XnaContent>

我看到其他一些帖子只使用 2d 纹理并绘制它,但没有。这默认使用 DrawString 的全部目的。

【问题讨论】:

  • 尝试将 TopBarFont.xnb 添加到 .SpriteFont 所在的同一文件夹中
  • MonoGame 有一个内容构建工具,你应该使用它。

标签: c# xna xna-4.0 monogame spritefont


【解决方案1】:

使用this转换器将.SpriteFont转换成.xnb

【讨论】:

  • 很遗憾我们不得不使用第三方工具,但没关系,它可以工作。这就是重要的。谢谢。
猜你喜欢
  • 2023-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多