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

Method LabelStrikethrough

tests/cpp-tests/Source/LabelTest/LabelTest.cpp:3795–3823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3793///
3794
3795LabelStrikethrough::LabelStrikethrough()
3796{
3797 auto s = Director::getInstance()->getWinSize();
3798
3799 // bmfont
3800 _label1a = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "hello strikethrough\nand multiline",
3801 TextHAlignment::LEFT, s.width);
3802 addChild(_label1a, 0, kTagBitmapAtlas1);
3803 _label1a->setPosition(Vec2(s.width / 2, s.height * 2 / 3));
3804 // you can enable underline by calling this method
3805 _label1a->enableStrikethrough();
3806
3807 // ttf
3808 TTFConfig ttfConfig("fonts/arial.ttf", 24);
3809 ttfConfig.strikethrough = true;
3810 _label2a = Label::createWithTTF(ttfConfig, "hello\nstrikethrough\nwith multiline", TextHAlignment::RIGHT, s.width);
3811 addChild(_label2a, 0, kTagBitmapAtlas2);
3812 _label2a->setPosition(Vec2(s.width / 2, s.height * 1 / 3));
3813
3814 auto menuItem = MenuItemFont::create("disable strikethrough", [&](ax::Object* sender) {
3815 _label2a->disableEffect(LabelEffect::STRIKETHROUGH);
3816 _label1a->disableEffect(LabelEffect::STRIKETHROUGH);
3817 });
3818 menuItem->setFontSizeObj(12);
3819 auto menu = Menu::createWithItem(menuItem);
3820 addChild(menu);
3821 auto winSize = Director::getInstance()->getWinSize();
3822 menu->setPosition(winSize.width * 0.86, winSize.height * 0.25f);
3823}
3824
3825std::string LabelStrikethrough::title() const
3826{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected