本文整理汇总了C++中CCLayerColor::initWithColorWidthHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayerColor::initWithColorWidthHeight方法的具体用法?C++ CCLayerColor::initWithColorWidthHeight怎么用?C++ CCLayerColor::initWithColorWidthHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayerColor
的用法示例。
在下文中一共展示了CCLayerColor::initWithColorWidthHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initTipLayer
bool TipLayer::initTipLayer()
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *maskLayer = CCLayerColor::node();
maskLayer->initWithColorWidthHeight(ccc4f(0x00,0x00,0x00,0x80),335,350);
//maskLayer->setOpacity(200);
maskLayer->setAnchorPoint(ccp(0.5, 0.5));
maskLayer->setPosition(ccp(winSize.width/2-maskLayer->getContentSize().width/2, winSize.height/2-maskLayer->getContentSize().height/2));
this->addChild(maskLayer);
/*CCSprite *bgSprite = CCSprite::spriteWithFile("actor_pause_bg.png");
this->addChild(bgSprite);
bgSprite->setPosition(ccp(winSize.width / 2, winSize.height / 2));*/
std::string stdNameOne = "";
std::string stdNameTwo = "";
std::string contentImageName = "";
stdNameOne = s_touchfile + s_language + "actor_btn_cancel.png";
stdNameTwo = s_touchfile + s_language + "actor_btn_confirm.png";
contentImageName = s_language + "actor_img_tipContent.png";
//content
CCSprite *pContentSprite = CCSprite::spriteWithFile(contentImageName.c_str());
this->addChild(pContentSprite);
pContentSprite->setPosition(ccp(winSize.width / 2, winSize.height / 2 +100));
CCMenuItemImage *cancelItem = CCMenuItemImage::itemFromNormalImage(stdNameOne.c_str(), stdNameOne.c_str(), this, menu_selector(TipLayer::cancel));
CCMenuItemImage *confirmItem = CCMenuItemImage::itemFromNormalImage(stdNameTwo.c_str(), stdNameTwo.c_str(), this, menu_selector(TipLayer::confirm));
CCMenu *menu = CCMenu::menuWithItems(confirmItem,cancelItem,NULL);
menu->alignItemsVertically();
menu->setPosition(ccp(winSize.width / 2, winSize.height / 2 - 50));
this->addChild(menu);
CCLayer::setIsKeypadEnabled(true);
return true;
}
示例2: CCLayerColor
CCLayerColor * CCLayerColor::layerWithColorWidthHeight(const ccColor4B& color, CCfloat width, CCfloat height)
{
CCLayerColor * pLayer = new CCLayerColor();
if( pLayer && pLayer->initWithColorWidthHeight(color,width,height))
{
pLayer->autorelease();
return pLayer;
}
CC_SAFE_DELETE(pLayer);
return NULL;
}