我试图在类似于上面显示的类中将 Spritefont 分配给Spritefont,这样我就不必每次都传递SpriteFonts和东西,但是每次使用Test_Font渲染时,都会出现引擎的null-exeption。Test_Font是空的。我知道SpriteFont是一个密封类,但是当我试图在主程序中分配Spritefonts时,它能工作吗?!
非常感谢!
P.S:对不起我的英语:)
class Engine
SpriteFont Test_Font;
public void Set_Engine(SpriteFont sf)
{
Test_Font = sf;
}
public void Render(SpriteBatch sb)
{
sb.DrawString(Test_Font, "Test", new Vector2(100, 100), Color.Red);
}发布于 2019-08-31 09:52:02
好吧,我想出来了,你还不能通过那些还没装好的东西。facepalm只是移动加载序列后面的分配,它可以工作。有时候我觉得自己很蠢。
祝您今天愉快。
https://stackoverflow.com/questions/57736636
复制相似问题