CCLabelTTF描边+阴影

   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), 2551);

    ttfShadow->setPosition(ccp(size.width/2,100));

    this->addChild(ttfShadow);



    效果图如下





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值