| 926 | } |
| 927 | |
| 928 | LabelFNTBounds::LabelFNTBounds() |
| 929 | { |
| 930 | auto s = Director::getInstance()->getWinSize(); |
| 931 | |
| 932 | auto layer = LayerColor::create(Color4B(128, 128, 128, 255)); |
| 933 | addChild(layer, -10); |
| 934 | |
| 935 | // LabelBMFont |
| 936 | auto label1 = |
| 937 | Label::createWithBMFont("fonts/boundsTestFont.fnt", "Testing Glyph Designer", TextHAlignment::CENTER, s.width); |
| 938 | addChild(label1); |
| 939 | label1->setPosition(Vec2(s.width / 2, s.height / 2)); |
| 940 | |
| 941 | auto drawNode = DrawNode::create(); |
| 942 | auto labelSize = label1->getContentSize(); |
| 943 | auto origin = Director::getInstance()->getWinSize(); |
| 944 | |
| 945 | origin.width = origin.width / 2 - (labelSize.width / 2); |
| 946 | origin.height = origin.height / 2 - (labelSize.height / 2); |
| 947 | |
| 948 | Vec2 vertices[4] = {Vec2(origin.width, origin.height), Vec2(labelSize.width + origin.width, origin.height), |
| 949 | Vec2(labelSize.width + origin.width, labelSize.height + origin.height), |
| 950 | Vec2(origin.width, labelSize.height + origin.height)}; |
| 951 | drawNode->drawPoly(vertices, 4, true, Color4F(1.0f, 1.0f, 1.0f, 1.0f)); |
| 952 | addChild(drawNode); |
| 953 | } |
| 954 | |
| 955 | std::string LabelFNTBounds::title() const |
| 956 | { |
nothing calls this directly
no test coverage detected