标签:
Node* node = CSLoader::createNode("home.csb"); this->addChild(node); Button* btnPlay = dynamic_cast<Button*>(node ->getChildByName("btnPlay")); Button* btnPlay = static_cast<ui::Button*>(Helper::seekWidgetByName(node, "btnPlay")); btnPlay ->addClickEventListener(CC_CALLBACK_1(XXX::onPlay, this)); btnPlay->addTouchEventListener(CC_CALLBACK_2(XXX::onPlay, this)); void XXX::onPlay(Ref *pSender, Widget::TouchEventType type) { switch (type) { case Widget::TouchEventType::BEGAN: break; case Widget::TouchEventType::MOVED: break; case Widget::TouchEventType::ENDED: break; case Widget::TouchEventType::CANCELED: break; default: break; } } void XXX::onPlay(Ref* sender) { }
标签:
原文地址:http://my.oschina.net/u/265368/blog/415613