// 创建一个按钮 auto btn_img_1 = Scale9Sprite::create("res/button.png"); btn_img_1->setContentSize(Size(76,33));// 按钮文本 btn_text LabelcreateWithTTF"按钮" "fonts/Marker Felt.ttf" 24// 按钮 button ControlButton(btn_textbtn_img_1 buttonsetPosition(Point400300thisaddChildbutton);
别忘了导入头文件
#include"extensions/cocos-ext.h"
usingnamespaceextension;
原文链接:https://www.f2er.com/cocos2dx/339852.html