问题描述
我在MonoGame利用Open GL制作一个太空侵略者游戏,我试图加载,我已经加入到内容文件夹纹理(它被称为侵略者的PNG文件)结果
中的我使用的代码是:
侵略者= Content.Load<&的Texture2D GT(侵略者);
然而,当我尝试运行它,它说:
Actually, you can load the PNG content that has been added to the Content folder directly like so:
invader = Content.Load<Texture2D>("Invader");
Note that the filename is case senitive on some platforms so be careful that it matches exactly. Also, make sure you've set the file to Content / Copy if newer in the Properties window.
The alternative is to compile your assets into optimized binary XNB files using the XNA Game Studio Content Pipeline or the MonoGame Content Pipeline. This will give you better performance but carries extra development overhead.
I should also mention that when rendering your sprites as raw PNG files you should use BlendState.NonPremultiplied in the call to SpriteBatch.Begin for best results. I've been doing it this way in my games for a while and I'm pretty happy with the results.
这篇关于C#MonoGame帮助? (Content.Load&所述;的Texture2D>(QUOT;入侵者"))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!