Esempio n. 1
0
UIButton* UIButton::createWithPngNames(const char *upName,const char *downName,const char *moveName,const char *text,float fontSize)
{
	UIButton *node = new UIButton();
	if (node)
	{
		node->_up = CCSprite::create(upName);
		node->_down = CCSprite::create(downName);
		node->_move = CCSprite::create(moveName);
		node->_textLabel = CCLabelTTF::create(text, "Arial", fontSize);
		if (node->_up && node->_down && node->_move)
		{
			node->addChild(node->_up);
			node->addChild(node->_down );
			node->addChild(node->_move);
			node->addChild(node->_textLabel);
			node->_up->setVisible(true);
			node->_down->setVisible(false);
			node->_move->setVisible(false);
			node->autorelease();
			return node;
		}
	}
	CC_SAFE_DELETE(node);
	return NULL;
}
Esempio n. 2
0
NS_CC_BEGIN
/**
 * 创建
 */
UIButton* UIButton::create(const char *upSprite,const char *downSprite)
{
	UIButton *node = new UIButton();
	if (node)
	{
		node->_up = CCSprite::create(upSprite);
		node->_down = CCSprite::create(downSprite);
		node->upPngName = upSprite;
		node->downPngName = downSprite;
		if (node->_up && node->_down)
		{
			node->addChild(node->_up);
			node->addChild(node->_down );
			node->_up->setVisible(true);
			node->_down->setVisible(false);
			node->autorelease();
			return node;
		}
	}
	CC_SAFE_DELETE(node);
	return NULL;
}
Esempio n. 3
0
UIButton* UIButton::create()
{
    UIButton* widget = new UIButton();
    if (widget && widget->init())
    {
        widget->autorelease();
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return NULL;
}
Esempio n. 4
0
UIButton*UIButton::create()
{
	UIButton *node = new UIButton();
	if (node)
	{
		node->autorelease();
		return node;
	}
	CC_SAFE_DELETE(node);
	return NULL;
}