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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.