我已經加入一些紋理我在XNA遊戲在一個單獨的類加載一個Texture2D,所以我決定做一個單獨的類加載和繪製紋理。使用C#和XNA
這是我迄今爲止
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace Trolls_and_Towers
{
class Textures
{
//Texture loading
//Buttons
public static Texture2D button;
public static void Load()
{
Microsoft.Xna.Framework.Game game = new Microsoft.Xna.Framework.Game();
button = game.Content.Load<Texture2D>("button");
}
public static void Draw()
{
Game1.spriteBatch.Draw(button, new Rectangle(20, Game1.screenHeight - 70, 100, 50), Color.White);
}
}
}
的問題是,它無法找到該按鈕的質感,我知道這是不是拼錯了,當我在Load方法加載它我遊戲它的工作原理