private Texture2D _characterTexture = null; //ココを追加 public Game1() { graphics = new GraphicsDeviceManager(this); //Content.RootDirectory = "Content"; Content.RootDirectory = "Content/Res"; //フォルダを作成したので変更 } protected override void LoadContent() { // 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 _characterTexture = Content.Load<Texture2D>("ColorBar"); //ココを追加 } ///<summary> /// This is called when the game should draw itself. ///</summary> ///<param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here this.spriteBatch.Begin(); this.spriteBatch.Draw(this._characterTexture, new Vector2(100, 100), new Rectangle(0, 0, 64, 64), Color.White); //左から1番目の絵を表示 this.spriteBatch.Draw(this._characterTexture, new Vector2(200, 100), new Rectangle(64, 0, 64, 64), Color.White); //左から2番目の絵を表示 this.spriteBatch.End(); base.Draw(gameTime); } |