如何加载图像 [英] How Do I Load An Image

查看:97
本文介绍了如何加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法加载图片投掷本教程请帮助



I cant seem to load an image threw this tutorial please help

public Texture2D player;
Vector2 position;
public SpriteBatch spriteBatch;

Vector2 mPosition = new Vector2(0, 0);
Texture2D mSpriteTexture = Content.Load<Texture2D>("player");

void Initialize(){
    // Create a new SpriteBatch, which can be used to draw textures.
    spriteBatch = new SpriteBatch (GraphicsDevice);
    // TODO: use this.Content to load your game content here
}

推荐答案

确保根内容目录中存在名为播放器的图像文件(它是内容文件夹, 默认情况下)。 (我想你正在使用XNA)
Ensure that an image file called 'player' exists in the root content directory (it is the Content folder, by default). (I suppose you're using XNA)


这篇关于如何加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆