cocos2dx 3.x UI之Button的初使用

cocos2dx 3.x UI之Button的初使用

1 Button使用的先决条件
在cocos2dx 3.x 在中使用Button,需要包含头文件

include "cocos-ext.h"

同时使用命名空间 UI

using namespace ui;

2 Button的使用

Button* back = Button::create();
back->setTitleText("back");
back->setTitleColor(Color3B::WHITE);
back->addTouchEventListener(CC_CALLBACK_0(T1GameScene::back, this));
back->setPosition(Vec2(50,size.height-50));
this->addChild(back);
posted @ 2015-11-08 15:39  沙影无痕  阅读(473)  评论(0编辑  收藏  举报