I have been trying to create a vertically aligned menu that is left-aligned and includes sub items that are themselves horizontally aligned menus.
You can see an example of this working perfectly for centre aligned menus at http://imgur.com/3PPfO
However, I’ve tried setting the anchors of all of the menu items (and the sub-menu) and the result is this: http://imgur.com/z695Y
All the items are now correctly justified, except for the row that is made up of a set of horizontally aligned controls. No matter what I try, I can’t get it to align properly. Any ideas?
The code that’s used to set it up is:
CCMenuPassive* tempMenu=CCMenuPassive::menuWithItems( standardButtonWithTitle(“1”), standardButtonWithTitle(“2”), standardButtonWithTitle(“3”), standardButtonWithTitle(“4”), NULL);
mainMenu = CCMenuPassive::menuWithItems(quickPlayButton, customGameButton, optionsButton, temp, NULL);
CCMenuPassive is almost identical to CCMenu, but it’s necessary to set the content size of the menu itself to the correct size (instead of defaulting to the screen size, as is done in CCMenu). I have checked the anchors and content sizes of the menus and they are all being set correctly, but for some reason, when it comes to the actual rendering, the anchor point doesn’t seem to make a difference. It’s almost as if the
tempMenu object is being rendered as if it had zero content size.