1053 auto size = Director::getInstance()->getWinSize();
1055 auto drawNode = DrawNode::create();
1056 drawNode->setAnchorPoint(Vec2(0, 0));
1057 this->addChild(drawNode);
1058 drawNode->drawSegment(
1059 Vec2(size.width * 0.1f, size.height * 0.8f),
1060 Vec2(size.width * 0.1, 0.0f), 1, Color4F(1.0f, 0.0f, 0.0f, 1.0f));
1061 drawNode->drawSegment(
1062 Vec2(size.width * 0.85f, size.height * 0.8f),
1063 Vec2(size.width * 0.85f, 0.0f), 1, Color4F(1.0f, 0.0f, 0.0f, 1.0f));
1065 TTFConfig ttfConfig(
"fonts/HKYuanMini.ttf", 25, GlyphCollection::DYNAMIC);
1066 auto label1 = Label::createWithTTF(ttfConfig,
1067 "你好,Cocos2d-x v3的New Label.", TextHAlignment::LEFT, size.width * 0.75f);
1069 label1->setTextColor(Color4B(128, 255, 255, 255));
1070 label1->setPosition(Vec2(size.width * 0.1f, size.height * 0.6f));
1071 label1->setAnchorPoint(Vec2(0.0f, 0.5f));
1072 this->addChild(label1);
1075 FontAtlasCache::unloadFontAtlasTTF(
"fonts/HKYuanMini.ttf");
1076 label1->setTTFConfig(ttfConfig);
1079 auto label2 = Label::createWithTTF(ttfConfig,
1080 "早上好,Cocos2d-x v3的New Label.", TextHAlignment::LEFT, size.width * 0.75f);
1082 label2->setTextColor(Color4B(255, 128, 255, 255));
1083 label2->setPosition(Vec2(size.width * 0.1f, size.height * 0.4f));
1084 label2->setAnchorPoint(Vec2(0.0f, 0.5f));
1085 this->addChild(label2);
1088 auto label3 = Label::createWithTTF(ttfConfig,
1089 "美好的一天啊美好的一天啊美好的一天啊", TextHAlignment::LEFT, size.width * 0.75f);
1091 label3->setTextColor(Color4B(255, 255, 128, 255));
1092 label3->setPosition(Vec2(size.width * 0.1f, size.height * 0.2f));
1093 label3->setAnchorPoint(Vec2(0.0f, 0.5f));
1094 this->addChild(label3);