Search code examples
cocos2d-x

is it possible to make a layer dim(cocos2dx)


I hope to pop up a new layer and make all layers under the layer become dim.

such as score board, dialog panel, I hope they can be clearer.

Is it possible?

Your comment welcome


Solution

  • In my project, I did this for a pause layer:

    CCLayerColor *bgLayer = CCLayerColor::create(ccc4(0,0,0,170));
    this->addChild(bgLayer);
    
    //Add other pause menu elements (Title, Resume button, quit button, etc.)
    

    I added this inside of a button click event, and the entire screen becomes dim. Just make sure this layer is on top of your other layers.