I am developing a 2D games with cocos2dx, in which I am still very new... inside the game, there's a number of UI Elements that I'd like to group together as one (I intend to group them into CCLayer
s). For example a few text labels and sprites form a CStatBar
which is a CCLayer
. This CStatBar
will then be included in the various other CCLayer
How do I do that? I created the CStatBar
class and then, inside the containing class's init() function, I CStatBar::create()
and call this->addChild(pStatBar)
however, the statbar did not appear... is there any obvious thing that I missed? All the positions are correct. Thanks!
EDIT:
Notes:
1. ccTouchesBegan
of the sublayer is called, however it is not rendered/seen
2. How do I resize the sublayer so that it only cover partial area of the parent layer? Supposedly the CStatBar
should only cover 10% of the top area of the screen, not the whole screen...