图层CCLayer是渲染框架中非常重要的内容。场景类用来划分游戏状态,图层就用来划分游戏画面。通常图层的尺寸会与屏幕尺寸一样。图层可以叠加,也可以彼此包含。
void HelloWorld::layerHandle() { CCLayer *layer = CCLayer::create(); this->addChild(layer); CCLayerColor *layerColor = CCLayerColor::create(ccc4(255,255)); layerColor->setContentSize(CCSizeMake(250,250)); this->addChild(layerColor); CCLayerColor *layerColor2 = CCLayerColor::create(ccc4(0,255,255),150,150); this->addChild(layerColor2); }原文链接:https://www.f2er.com/cocos2dx/347068.html