Usage of UILayer and UIPanel

Usage of UILayer and UIPanel
0.0 0


Hi, I am newbie to cocos2d-x. I am confuse about the usage of components in extension.

  1. In many tutorial, the usage of UILayer is like this: class MyLayer derived from CCLayer and contain UILayer pointer as data member. In fact UILayer “is-a” CCLayer, so what if I declare MyLayer which derived from UILayer?
  2. The UIPanel almost like a Layer(container of node and response for input), it contain all widgets edited in UI editor and widgets can bind user input callback. This way is very similar to UI framework such as MFC, wxWidget… This weaken the traditional cocos2d ideal: a scene contain multi-layer. I can use only one UILayer in a scene and let the layer contain all UIPanels. Or I can follow cocos2d tradition that warp each UIPanel in a UILayer.

Whatever method use the project can be done, but what is the suggest way? It seems there is no official example, so it is hard to get it as it supposed to be.