Exemplo n.º 1
0
CButton* TuiManager::createBtn(float tag, Color3B color, int fontSize, const char* font, const char* lab, const char* normal, const char* select, const char* disable, float x, float y, float w, float h, float rotation, int isUseFrame){
	CButton * pBtn = NULL;
	if(isUseFrame){
		pBtn = CButton::createWith9SpriteFrameName(Size(w, h), normal, select, disable);
	}else{
		pBtn = CButton::createWith9Sprite(Size(w,h),normal,select,disable);
	}
	if (lab) pBtn->initText(lab, font, fontSize, Size::ZERO, color);
	pBtn->setRotation(rotation);
	pBtn->setPosition(Vec2(x,-y));
	pBtn->setTag(tag);
	return pBtn;
}
Exemplo n.º 2
0
CButton* TuiManager::createBtn(float tag, const char* normal,const char* select,const char* disable,float x,float y,float w, float h,float rotation){
	CButton * pBtn = NULL;
	if(m_isUseSpriteFrame){
		pBtn = CButton::create();
		pBtn->setNormalSpriteFrameName(normal);
		pBtn->setSelectedSpriteFrameName(select);
		pBtn->setDisabledSpriteFrameName(disable);
	}else{
		pBtn = CButton::createWith9Sprite(Size(w,h),normal,select,disable);
	}
	pBtn->setRotation(rotation);
	pBtn->setPosition(Point(x,-y));
	pBtn->setTag(tag);
	return pBtn;
}