我是XNA的新手,我开始遵循一个在屏幕上绘制图像的教程.我能够将我的图像移动到Content文件夹中,但是当我尝试在我的代码中使用它时,无法找到它.
我正在使用资产名称而我找不到我做错了什么.教程使用XNA 3.0,我使用的是Visual Studio 2010,不确定是否重要.
这是我的代码
public class Game1 : Microsoft.Xna.Framework.Game
{
Vector2 mPosition = new Vector2(0, 0);
Texture2D mSpriteTexture;
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
mSpriteTexture = Content.Load<Texture2D>("Face");
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{ …Run Code Online (Sandbox Code Playgroud)