csb文件加载
Node* node = CSLoader::createNode("res/MainScene.csb");
this->addChild(node);
Button使用
ui::Button *button = (ui::Button *)node->getChildByName("actionBt");
//给这个按钮增加一个touch的侦听(这边就和cocos2dx有不同了)
using namespace cocos2d::ui;
using namespace cocostudio;
button->addClickEventListener(CC_CALLBACK_1(HelloWorld::buttonAction, this));
时间: 2024-11-09 17:27:04