实际上,我正在尝试制作在窗口上显示一些图片的程序,这是代码的一部分
public Texture2D tulTexture;
//...
protected override void LoadContent()
{
// Instantiate a SpriteBatch
spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice));
// Loads the balls texture (32 textures (32x32) stored vertically => 32 x 1024 ).
// The [Balls.dds] file is defined with the build action [ToolkitTexture] in the project
tulTexture = this.Content.Load<Texture2D>("T.jpg");
// Loads a sprite font
// The [Arial16.xml] file is defined with the build action [ToolkitFont] in the project
base.LoadContent();
}
当我运行程序时,我得到的是AssetNotFoundException,但这是谎言,我有这个资产!
发布于 2014-09-28 23:40:50
AssetNotFoundException,但这是骗人的,我有这个资产!
很可能您没有将您的纹理配置为构建的一部分。您需要在VS中设置纹理上的操作"ToolkitTexture“,并读取没有".jpg”的纹理Content.Load<Texture2D>("T")
,就像在SharpDX示例中所做的那样。这将在您粘贴的代码的注释中解释。
https://stackoverflow.com/questions/26088808
复制相似问题