Hello.
I’m trying to create a menu. I’m following this documentation. As for I understand, any kind of MenuItem is capable of triggering a method. I want to click a label and print some text in the console (just to check if it works).
I have the following code:
auto myLabel = Label::createWithTTF("My texttttttt", "fonts/Marker Felt.ttf", 24);
myLabel->setPosition(Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height - myLabel->getContentSize().height - 20));
myLabel->enableGlow(Color4B::YELLOW);
auto myItem = MenuItemLabel::create(myLabel,[&](Ref* sender){ cout << "Hello";});
// create menu, it's an autorelease object
auto menu = Menu::create(closeItem, myItem, NULL);
menu->setPosition(Vec2::ZERO);
this->addChild(menu, 1);
The label appears perfectly but nothing happens if I click it.
Any help is appreciated, thanks.
