| 3599 | /// |
| 3600 | |
| 3601 | LabelUnderlineMultiline::LabelUnderlineMultiline() |
| 3602 | { |
| 3603 | auto s = Director::getInstance()->getWinSize(); |
| 3604 | |
| 3605 | // bmfont |
| 3606 | _label1a = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "hello underline\nand multiline", |
| 3607 | TextHAlignment::CENTER, s.width); |
| 3608 | addChild(_label1a, 0, kTagBitmapAtlas1); |
| 3609 | _label1a->setPosition(Vec2(s.width / 2, s.height * 2 / 3)); |
| 3610 | // you can enable underline by calling this method |
| 3611 | _label1a->enableUnderline(); |
| 3612 | |
| 3613 | // ttf |
| 3614 | TTFConfig ttfConfig("fonts/arial.ttf", 24); |
| 3615 | ttfConfig.underline = true; |
| 3616 | _label2a = Label::createWithTTF(ttfConfig, "hello\nunderline\nwith multiline", TextHAlignment::LEFT, s.width); |
| 3617 | addChild(_label2a, 0, kTagBitmapAtlas2); |
| 3618 | _label2a->setPosition(Vec2(s.width / 2, s.height * 1 / 3)); |
| 3619 | |
| 3620 | auto menuItem = MenuItemFont::create("disable underline", [&](ax::Object* sender) { |
| 3621 | _label2a->disableEffect(LabelEffect::UNDERLINE); |
| 3622 | _label1a->disableEffect(LabelEffect::UNDERLINE); |
| 3623 | }); |
| 3624 | menuItem->setFontSizeObj(12); |
| 3625 | auto menu = Menu::createWithItem(menuItem); |
| 3626 | addChild(menu); |
| 3627 | auto winSize = Director::getInstance()->getWinSize(); |
| 3628 | menu->setPosition(winSize.width * 0.9, winSize.height * 0.25f); |
| 3629 | } |
| 3630 | |
| 3631 | std::string LabelUnderlineMultiline::title() const |
| 3632 | { |
nothing calls this directly
no test coverage detected