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

Method LabelFNTBounds

tests/cpp-tests/Source/LabelTest/LabelTest.cpp:928–953  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

926}
927
928LabelFNTBounds::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
955std::string LabelFNTBounds::title() const
956{

Callers

nothing calls this directly

Calls 8

getInstanceFunction · 0.85
createFunction · 0.85
Color4BFunction · 0.85
drawPolyMethod · 0.80
Vec2Function · 0.50
Color4FFunction · 0.50
setPositionMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected