CCLabelTTF* createTextWithBorder(int size,const char* content, int contentColor, int borderColor)
{
//通过将两个不同尺寸的字体叠在一起来实现描边的效果
//边字体
CCLabelTTF* border=CCLabelTTF::create(content, FONT_NAME, size+4);
border->setColor(Color::IntTranColor3B(borderColor));
//内容字体
CCLabelTTF* text=CCLabelTTF::create(content,FONT_NAME, size);
text->setColor(Color::IntTranColor3B(contentColor));
border->addChild(text);
//内容字体置中放在边字体上
text->setAnchorPoint(ccp(0.5f,0.5f));
text->setPosition(ccp(border->getContentSize().width/2,border->getContentSize().height/2));
return border;
}
{
//通过将两个不同尺寸的字体叠在一起来实现描边的效果
//边字体
CCLabelTTF* border=CCLabelTTF::create(content, FONT_NAME, size+4);
border->setColor(Color::IntTranColor3B(borderColor));
//内容字体
CCLabelTTF* text=CCLabelTTF::create(content,FONT_NAME, size);
text->setColor(Color::IntTranColor3B(contentColor));
border->addChild(text);
//内容字体置中放在边字体上
text->setAnchorPoint(ccp(0.5f,0.5f));
text->setPosition(ccp(border->getContentSize().width/2,border->getContentSize().height/2));
return border;
}