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


C++ LayerColor::setColor方法代码示例

本文整理汇总了C++中LayerColor::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerColor::setColor方法的具体用法?C++ LayerColor::setColor怎么用?C++ LayerColor::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LayerColor的用法示例。


在下文中一共展示了LayerColor::setColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool GameNext::init()
{
    //////////////////////////////
    // 1. super init first
    if (!Scene::init())
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    /////////////////////////////

    
    if(game_round<=9)
    {
        gr_pic = "0" + Value(game_round).asString();
    }else if(game_round>=10)
    {
        gr_pic = Value(game_round).asString();
    }
    
    if((game_level-1)<=9)
    {
        gl_pic = "0" + Value(game_level-1).asString();
    }else if((game_level-1)>=10)
    {
        gl_pic = Value(game_level-1).asString();
    }
    
    
    //被弄成灰色的截图
    auto ac = Sprite::create(picNext);
    ac->setAnchorPoint(Vec2(0,0));
    ac->setPosition(Vec2(0,0));
    ac->setScaleX(visibleSize.width/ac->getTextureRect().getMaxX()); //设置精灵宽度缩放比例
    ac->setScaleY(visibleSize.height/ac->getTextureRect().getMaxY());
    this->addChild(ac,100);
    
    
    //半透明层,在截图之上
    LayerColor* layerColor = CCLayerColor::create();
    layerColor->setColor(cocos2d::Color3B(0, 0, 0));
    layerColor->setOpacity(150);
    layerColor->setContentSize(Size(visibleSize.width, visibleSize.height));
    this->addChild(layerColor,101);
    
    
    //next小方块的背景
    auto gameover = Sprite::create("setting/gamenext.png");
    gameover->setPosition(Vec2(origin.x + visibleSize.width/2,origin.y + visibleSize.height/2));
    this->addChild(gameover,102);
    
    
    scheduleUpdate();
    
    return true;
    
}
开发者ID:kimikimi911,项目名称:growup,代码行数:60,代码来源:GameNext.cpp

示例2: init

bool GameOver::init()
{
    //////////////////////////////
    // 1. super init first
    if (!Scene::init())
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    
    /////////////////////////////
   
    
    
    
    auto ac = Sprite::create(picOver);
    ac->setAnchorPoint(Vec2(0,0));
    ac->setPosition(Vec2(0,0));
    ac->setScaleX(visibleSize.width/ac->getTextureRect().getMaxX()); //设置精灵宽度缩放比例
    ac->setScaleY(visibleSize.height/ac->getTextureRect().getMaxY());
    
    this->addChild(ac,100);
    
    
    
    
    //半透明层
    
    LayerColor* layerColor = CCLayerColor::create();
    
    layerColor->setColor(cocos2d::Color3B(0, 0, 0));
    
    layerColor->setOpacity(150);
    
    layerColor->setContentSize(Size(visibleSize.width, visibleSize.height));
    
    this->addChild(layerColor,101);
    
    
    auto gameover = Sprite::create("setting/gameover.png");
    //gameover->setAnchorPoint(Vec2(0,0));
    gameover->setPosition(Vec2(origin.x + visibleSize.width/2,
                               origin.y + visibleSize.height/2));
    this->addChild(gameover,102);
    

    
    scheduleUpdate();
    
    return true;
    
}
开发者ID:kimikimi911,项目名称:growup,代码行数:54,代码来源:GameOver.cpp

示例3: init

bool GameWinLayer::init()
{
	if (!Layer::init())
	{
		return false;
	}
	Size visibleSize = Director::sharedDirector()->getVisibleSize();

	// finish layer
	LayerColor* layerColor = LayerColor::create();
	layerColor->setColor(Color3B(0, 0, 0));
	layerColor->setOpacity(150);
	layerColor->setContentSize(Size(visibleSize.width, visibleSize.height));
	this->addChild(layerColor, 1);

	return true;
}
开发者ID:MingkaiMa824,项目名称:iPhone2015,代码行数:17,代码来源:GameWinLayer.cpp


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