-
Book Overview & Buying
-
Table Of Contents
Android NDK Game Development Cookbook
By :
In the previous recipe, we learned how to render the game screen. Some classes remained unimplemented. In this recipe, we will implement the clBricksShape class responsible for the storage and manipulation of each of the shapes that appear in the game.
Take a look at how many different pentomino shapes can exist. Wikipedia provides a comprehensive overview: http://en.wikipedia.org/wiki/Pentomino.
The interface of our clBricksShape class looks as follows:
class clBricksShape
{
public:The size of shapes used in our game. We use 5x5 shapes.
static const int FWidth = SHAPES_X; static const int FHeight = SHAPES_Y;
Store the colors of the cells this shape consists of. The colors are stored as indices:
private: int FColor[NUM_COLORS];
The figure index defines the shape type:
int FFigureIndex;
The rotation index corresponds to the rotation angle of the figure: 0, 1, 2, and 3 stand for 0, 90, 180, and 270 degrees:
int FRotationIndex;
The methods are very...
Change the font size
Change margin width
Change background colour