CCSize size = CCDirector::sharedDirector()->getWinSize();
//创建一个全屏灰色底图
ccColor4B c = {100,100,100,255};
CCLayerColor *layerColr = CCLayerColor::create(c);
layerColr->setContentSize(CCDirector::sharedDirector()->getWinSize());
this->addChild(layerColr);
//测试CCLabelTTF中的enableStroke效果
CCLabelTTF *ttf = CCLabelTTF::create("正常效果","Arial",50);
ttf->setColor(ccWHITE);
ttf->setPosition(ccp(size.width/2,500));
this->addChild(ttf);
//红字黑边
CCLabelTTF *ttfStroke =CCLabelTTF::create("ttf:Stroke效果(Red+stroke:Green)","Arial",50);
ttfStroke->setColor(ccRED); //设置红色
ccColor3B c3b = ccGREEN; //绿笔
ttfStroke->enableStroke(c3b, 0.8); //花边
ttfStroke->setPosition(ccp(size.width/2,400));
this->addChild(ttfStroke);
//白字黑边
CCLabelTTF *ttfStroke2 =CCLabelTTF::create("ttf:Stroke效果(white+stroke:Black)","Arial",50);
ttfStroke2->setColor(ccWHITE); //设置白色
ccColor3B c3b2 = ccBLACK; //黑笔
ttfStroke2->enableStroke(c3b2, 0.8); //花边
ttfStroke2->setPosition(ccp(size.width/2,300));
this->addChild(ttfStroke2);
//白字绿边
CCLabelTTF *ttfStroke3 =CCLabelTTF::create("ttf:Stroke效果(white+stroke:Black)","Arial",50);
ttfStroke3->setColor(ccWHITE); //设置白色
ccColor3B c3b3 = ccGREEN; //绿笔
ttfStroke3->enableStroke(c3b3, 0.8); //花边
ttfStroke3->setPosition(ccp(size.width/2,200));
this->addChild(ttfStroke3);
//阴影
CCLabelTTF *ttfShadow = CCLabelTTF::create("ttf:ttfShadow测试", "Arial", 50);
//偏移量(为0,0就没什么效果了),透明度(0~255), 模糊程度(越大越明显)
ttfShadow->enableShadow(CCSizeMake(-5,-5), 255, 1);
ttfShadow->setPosition(ccp(size.width/2,100));
this->addChild(ttfShadow);
效果图如下