Time for action – placing the cube
1. From the book's companion website, download the
7089_04_GRAPHICSPACK.ZIP
file and extract thecircuitboard.png
file to a temporary location.2. Back in Visual Studio, right-click on the content project (listed as Cube ChaserContent (Content)) in Solution Explorer and select Add | Existing Item....
3. Browse to the
circuitboard.png
file you just extracted, select it, and click Add:4. Add a new class file called
Cube.cs
to the Cube Chaser project.5. Add the following
using
directives to the top of the class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
6. Add the following fields to your new
Cube
class:#region Fields private GraphicsDevice device; private Texture2D texture; private Vector3 location; private VertexBuffer cubeVertexBuffer; private List<VertexPositionTexture> vertices = new List<VertexPositionTexture>(); #endregion
7. Add a constructor to the
Cube
class:#region Constructor public Cube( GraphicsDevice...