Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The Figure Class


All figures can be moved to the left or the right as well as be rotated clockwise or counterclockwise as a response to the user's requests. They can also be moved downwards as a response to the timer. The crossed square in the figures of this section marks the center of the figure, that is, the position the fields m_iRow and m_iCol of the Figure class refer to.

All kinds of figures are in fact objects of the Figure class. What differs between the figures are their colors and their shapes. The files FigureInfo.h and FigureInfo.cpp holds the information specific for each kind of figure, see the next section.

The field m_rfColor holds the color of the figure, m_pColorGrid is a pointer to the color grid of the game grid, m_iRow, m_iCol, and m_iDirection are the positions and the directions of the figure, respectively. The figure can be rotated into the directions north, east, south, and west. However, the red figure is a square, so it cannot be rotated at all. Moreover, the brown...