| 3793 | /// |
| 3794 | |
| 3795 | LabelStrikethrough::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 | |
| 3825 | std::string LabelStrikethrough::title() const |
| 3826 | { |
nothing calls this directly
no test coverage detected