2006-04-19

Mu Torere, the Stone Singleton

Step 8.
A basic Singleton instance, all that is required of this class is to draw the playing pieces.
Why isn't this folded in with one of the other classes? The basic reason is that this class can be considered a working stub class. If need be, a different drawing routine can be substituted to draw 3-D playing pieces. Or a Sprite class can be used instead. Or the user can decide.

For drawing;
void CStone::Draw(CDC* pDC, const COLORREF& res, const CRect& rect)
Create a 2-pixel wide pen with the colour of the menu text, usu. black.
Create a solid bruch with the provided colour, res.

Select the pen and the brush into the drawing context.
Draw an Ellipse contained by rect.
Select the old pen and old brush back into the drawing context.
Note that all the needed information for drawing the piece is provided. Nothing is stored in the CStone instance.

No comments: