Which UI classes do we use?

I notice we have a cocos2d::gui/cocos2d::ui namespace now that has a bunch of UI objects and classes like Text, Widget, Layout, and Button.

Do we use them instead of Label, Node, Layer, or MenuItem?

Also, we have a lot of Label classes now, which of them should we use? Can we keep using LabelTTF and LabelBMFont?

@lance_gray
You can use whatever you like.

My recommend is always prefer cocos2d::ui controls over other options.
Because in the future, we will maintain only one type of ui system.

If I convert my Node sub-classes to Widget, do I have to do anything special? Do Widgets behave exactly like Node?

For example, if I have a sub-class of Node and use it as a Node, then I simply change the super-class to Widget will it work properly?

@lance_gray

You can’t convert Node subclass to Widget. If you do want to make something like Widget, try to subclass Widget class.

Widget is inherent from ProtectedNode which is also inheritent from Node. So any thing you can do with Node can also be applied to the Widget class and its subclasses.

One thing you should notice is that “when you are adding a widget subclass to a widget, it will maintains its own children widgets, while when you are adding a Node class to widget, it will be add to the scene graph”.

You can take a look at the implementation of ProtectedNode class.