1211 auto size = Director::getInstance()->getWinSize();
1212 TTFConfig ttfConfig(
"fonts/arial.ttf", 40, GlyphCollection::DYNAMIC,
nullptr,
true);
1214 auto label1 = Label::createWithTTF(ttfConfig,
"Distance Field",TextHAlignment::CENTER,size.width);
1215 label1->setPosition( Vec2(size.width/2, size.height * 0.6f) );
1216 label1->setTextColor( Color4B::GREEN );
1219 auto action = Sequence::create(
1220 DelayTime::create(1.0f),
1221 ScaleTo::create(6.0f,5.0f,5.0f),
1222 ScaleTo::create(6.0f,1.0f,1.0f),
1224 label1->runAction(RepeatForever::create(action));
1227 auto& labelContentSize = label1->getContentSize();
1228 auto borderDraw = DrawNode::create();
1229 label1->addChild(borderDraw);
1230 borderDraw->clear();
1231 borderDraw->setLineWidth(1);
1235 Vec2(labelContentSize.width, 0.0f),
1236 Vec2(labelContentSize.width, labelContentSize.height),
1237 Vec2(0.0f, labelContentSize.height)
1239 borderDraw->drawPoly(vertices, 4,
true, Color4F::RED);
1241 auto label2 = Label::createWithTTF(ttfConfig,
"Distance Field",TextHAlignment::CENTER,size.width);
1242 label2->setPosition( Vec2(size.width/2, size.height * 0.3f) );
1243 label2->setTextColor( Color4B::RED );
1247 auto& labelContentSize2 = label2->getContentSize();
1248 auto borderDraw2 = DrawNode::create();
1249 label2->addChild(borderDraw2);
1250 borderDraw2->clear();
1251 borderDraw2->setLineWidth(1);
1255 Vec2(labelContentSize2.width, 0.0f),
1256 Vec2(labelContentSize2.width, labelContentSize2.height),
1257 Vec2(0.0f, labelContentSize2.height)
1259 borderDraw2->drawPoly(vertices2, 4,
true, Color4F::GREEN);