Directly on the steps: (with the Cocos2dx-js frame comes with an airplane for example)
1. Open Cocos studio2.0 new node file
2. Import the resources and design the new node files as needed
The red box is the imported resource in the blue box for the layout of the CSD file (note that the background map coordinates are set to (0,0), the anchor point is set to (0,0), the other element anchors are set to (0.5,0.5), the buttons are set to the button type, and the picture resource is set to normal and selected
3. Publish the project to vs2013 (Cocos Studio default Publish project file is res, not resource[does not know how to set the publishing path], so the resource and generated CSB file is copied to the resource file)
4. Open vs2013, add the following code
_rootnode = Csloader::createnode ("MENU.CSB"); This->addchild (_rootnode, 1); Auto newbtn = dynamic_cast<button* > (_rootnode->getchildbyname ("newbtn")); Newbtn->addtoucheventlistener (Cc_callback_1 (MainScene:: Newbtncallback, this)); Auto optionbtn = dynamic_cast<button*> (_rootnode->getchildbyname ("OptionBtn")); O Ptionbtn->addtoucheventlistener (Cc_callback_1 (Mainscene::optionbtncallback, this)); Auto AboutBtn = dynamic_cast <Button*> (_rootnode->getchildbyname ("aboutbtn")); Aboutbtn->addtoucheventlistener (Cc_callback_1 ( Mainscene::aboutbtncallback, this));
The corresponding time listener function is set to the member function to
Start game void Mainscene::newbtncallback (cocos2d::ref* psender) {}//option box void Mainscene::optionbtncallback (cocos2d::Ref* Psender) {}//about box void Mainscene::aboutbtncallback (cocos2d::ref* psender) {}
5. Compile and run
Note: The above blog is only a personal study record, if there are errors, please note that the message
cocos2dx3.3. csb files that are exported using Cocos studio2.0