Hi, I’m struggling to figure out how to control the hit area of my MenuItems. The code below shows what I’m doing:
// a Node subclass containing a Slice9Sprite background and a Label:
playButtonView = BoxButton::create("PLAY", 50);
playButton = cocos2d::MenuItemSprite::create(
playButtonView,
playButtonView,
CC_CALLBACK_1(DevPregameScreen::onClick, this));
menu = cocos2d::Menu::create(
playButton,
NULL);
The BoxButton is laid out centered on the [0,0] point (by which I mean, the anchorPoint is int he middle of the button.) Internally, it uses:
this->setContentSize()
My problem is that the hit area of the button is offset, so I can only click on the upper right quarter of the button. It is obvious that the hit area is a rectangle that starts at [0,0], rather than the bounding box of the button. Is there any way to offset / control the hit area? Do all menu Items have to be designed around this restriction? It makes it a lot more difficult to calculate positions and offsets when dynamically laying out content.
Thanks