当前位置: 首页>>代码示例>>C++>>正文


C++ CCLayerColor::initWithColorWidthHeight方法代码示例

本文整理汇总了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;
}
开发者ID:david4750,项目名称:ShootGame,代码行数:35,代码来源:TipLayer.cpp

示例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;
}
开发者ID:hiceka,项目名称:cocos2dx-win8,代码行数:11,代码来源:CCLayer.cpp


注:本文中的CCLayerColor::initWithColorWidthHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。