在我的简单游戏中,我在纹理中加载了很多问题。首先,我可以在“Game1.cs”内部加载纹理。但是,我目前正在尝试创建一个级别。所以我想加载Level类中的所有图片。
public Level(IServiceProvider _serviceProvider)
{
content = new ContentManager(_serviceProvider, "Content");
mNrOfTextures = 3;
mTextures[] = new Texture2D[mNrTextures];
mTextures[0] = Content.Load<Texture2D>("sky");
//And then more textures and other stuff..
}
但程序永远找不到文件天空。我真的没有得到任何有用的错误消息,我现在正在远离任何教程。有人能指出我正确的方向吗?
文件的完整路径:C:\ c ++ \ ProjIV \ ProjIV \ ProjIVContent \
答案 0 :(得分:0)
我个人只是将我的ContentManager
传递给我的关卡课程,而不是像其他人那样通过服务提供商。
在这种情况下,您需要使用本地content
实例,而不是静态Content
mTextures[0] = content.Load<Texture2D>("sky");
编辑:我认为这不起作用,您可以附上解决方案布局的图片和内容吗?