MCPcopy Create free account
hub / github.com/axmolengine/axmol / LabelUnderlineMultiline

Method LabelUnderlineMultiline

tests/cpp-tests/Source/LabelTest/LabelTest.cpp:3601–3629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3599///
3600
3601LabelUnderlineMultiline::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
3631std::string LabelUnderlineMultiline::title() const
3632{

Callers

nothing calls this directly

Calls 7

getInstanceFunction · 0.85
createFunction · 0.85
enableUnderlineMethod · 0.80
setFontSizeObjMethod · 0.80
Vec2Function · 0.50
setPositionMethod · 0.45
disableEffectMethod · 0.45

Tested by

no test coverage detected