Search code examples
cocos2d-x

cc.Label enabled stroke works but color does not change


 var label0 = cc.LabelTTF.create("test", "Arial",48 );
 label0.setColor(cc.c4f(0,0,0,255));
 this.addChild(label0, 1);
 label0.setPosition( cc.p(0, 80));
 label0.enableStroke(cc.c3b(100,10,0),3,true);

I try to change r,g,b value in label0.enableStroke(cc.c3b(100,10,0),3,true);

but it never change and display same color as label0.setColor(cc.c4f(0,0,0,255));

or

my usage has any problem?


Solution

  • Try This..

    CCLabelTTF*label=CCLabelTTF::create("My Text", "Thonburi", 15 );
    int r,g,b;
    r=100;
    g=80;
    b=255-r-g;
    label->setColor(ccc3(r,g,b));