2015-01-26 51 views
2

我正在尝试在Monogame程序中绘制文本。我想使用SpriteFont来做到这一点,但是当我尝试加载SpriteFont时出现以下错误。错误 - 未实现SpriteFont

//Here I try to load the SpriteFont 
//It is kept in the "Content/fonts" folder, with "Content" as the Content.RootDirectory 
Font = Content.Load<SpriteFont>("fonts/SpriteFont1"); 

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

将SpriteFont1构建操作设置为“Content”,并将其复制到输出目录为“始终复制”。 SpriteFont1.xnb文件位于Content文件夹中,具有相同的设置。我如何解决这个错误,以便我可以加载SpriteFont?

+0

方法没有实现。这可能在Mono库中。堆栈跟踪将显示哪种方法。 – 2015-01-26 23:31:40

+0

我编辑了你的标题。请参阅:“[应该在其标题中包含”标签“](http://meta.stackexchange.com/questions/19190/)”,其中的共识是“不,他们不应该”。 – 2015-01-27 00:33:13

回答

5

简单修复。在堆栈跟踪之后(感谢Richard Schneider),我发现SpriteFont1.xnb文件需要与实际的.SpriteFont文件位于同一文件夹中。

0

实际上,只需要.xnb文件,因为它是从.SpriteFont编译的,因此您应该只将.xnb文件复制到Content文件夹。

NotImplementedException是因为LoadContent没有实现直接加载.SpriteFont文件。 (在MonoGame 3.5中测试)