Does Anyone know how to create a button and check if it got pressed or not?
at the moment i’m using the following code:
auto bt1 = MenuItemImage::create("arrow_left.png","arrow_left.png",CC_CALLBACK_1(InGameScene::menuBT1Callback, this));
auto bt = Menu::create(bt1, NULL);
bt->setPosition(350,500);
bt->setPositionZ(10);
bt->setScale(1);
this->addChild(bt,1);
But, this only recognizes clicks, but not if it’s still pressed or if it got released.
I want to do something as long as the button is pressed and stop if button is released.
As far as I know subclasses of MenuItem do not support what you need.
But you could subclass the new ui::button and override onPressStateChangedToPressed() and onPressStateChangedToNormal()