
31310.7. Isometric Projection
{
// Isometric Diamond draw
if((row + col) % 2)
{
boardSquare.setX((float)( BOARD_X -
(row*TEXTURE_SIZE/2) +
(col*TEXTURE_SIZE/2) ));
boardSquare.setY((float)( BOARD_Y +
(row*TEXTURE_SIZE/4) +
(col*TEXTURE_SIZE/4) ));
boardSquare.draw(graphicsNS::BLACK);
}
else
{
boardSquare.setX((float)( BOARD_X -
(row*TEXTURE_SIZE/2) +
(col*TEXTURE_SIZE/2) ));
boardSquare.setY((float)( BOARD_Y +
(row*TEXTURE_SIZE/4) +
(col*TEXTURE_SIZE/4) ));
boardSquare.draw(graphicsNS::WHITE);
}
}
}
Listing 10.5. e code that draws an isometric checkerboard.
e position of the checkers is determined using the same formula that we used to position ...