| 1073 | } |
| 1074 | |
| 1075 | LabelTTFDynamicAlignment::LabelTTFDynamicAlignment() |
| 1076 | { |
| 1077 | auto winSize = Director::getInstance()->getWinSize(); |
| 1078 | |
| 1079 | TTFConfig ttfConfig("fonts/arial.ttf", 23); |
| 1080 | _label = Label::createWithTTF(ttfConfig, LongSentencesExample, TextHAlignment::CENTER, winSize.width); |
| 1081 | _label->setPosition(winSize.width / 2, winSize.height / 2); |
| 1082 | addChild(_label); |
| 1083 | |
| 1084 | auto menu = Menu::create( |
| 1085 | MenuItemFont::create("Left", AX_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentLeft, this)), |
| 1086 | MenuItemFont::create("Center", AX_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentCenter, this)), |
| 1087 | MenuItemFont::create("Right", AX_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentRight, this)), nullptr); |
| 1088 | |
| 1089 | menu->alignItemsHorizontallyWithPadding(20); |
| 1090 | menu->setPosition(winSize.width / 2, winSize.height * 0.25f); |
| 1091 | addChild(menu); |
| 1092 | } |
| 1093 | |
| 1094 | void LabelTTFDynamicAlignment::updateAlignment() |
| 1095 | { |
nothing calls this directly
no test coverage detected