9.4. Composite sprites

The cSpriteComposite holds an array of cSprite pointers called _childspriteptr. The default cSpriteComposite::draw behavior is to walk the array and call draw for each of the child sprites.

for (int i=0; i< _childspriteptr.GetSize(); i++) 
    _childspriteptr[i]->draw(pgraphics, drawflags); 

We can make some nice shapes this way. We’ll consider two examples in this section: the cSpriteBubble and the cPolyPolygon.

The cSpriteBubble

The PickNPoP game viewed in OpenGL 3D. On the left are cSpriteBubble and cSpriteBubbleGrayScale, on the right are cSpriteBubblePie

The cSpriteBubble consists of a disk with a rectangular highlight ...

Get Software Engineering and Computer Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.