Game Development Reference
In-Depth Information
Figure 6.5
Sprite layout.
consider how they will be used. Here is some pseudo code of how sprites might
be used.
Renderer renderer = new Renderer();
Sprite spaceship = new Sprite();
spaceship.SetPosition(0, 0);
spaceship.SetTexture(_textureManager.Get("spaceship"));
renderer.DrawSprite(spaceship);
A quad is made from four vertices, but it's common practice to use six vertices
and draw two triangles to make up the quad. Graphics cards work very well with
triangles, so many engines have all their assets broken up into triangles or tri-
angle strips. The quad is broken up as shown in Figure 6.6.
Coding as you read helps you understand the material. There's no need to start a
new project; the GameStructure project can be reused. Create a new class that
inherits from IGameObject , called DrawSpriteState .
 
Search WWH ::




Custom Search