mirror of https://github.com/axmolengine/axmol.git
issue #4636, finish UITextBMFont
This commit is contained in:
parent
08bf6c27f4
commit
ed2c38eb98
|
@ -88,7 +88,7 @@ void TextBMFont::setFntFile(const std::string& fileName)
|
|||
updateAnchorPoint();
|
||||
labelBMFontScaleChangedWithSize();
|
||||
_fntFileHasInit = true;
|
||||
setText(_stringValue.c_str());
|
||||
setText(_stringValue);
|
||||
}
|
||||
|
||||
void TextBMFont::setText(const std::string& value)
|
||||
|
@ -181,8 +181,8 @@ void TextBMFont::copySpecialProperties(Widget *widget)
|
|||
TextBMFont* labelBMFont = dynamic_cast<TextBMFont*>(widget);
|
||||
if (labelBMFont)
|
||||
{
|
||||
setFntFile(labelBMFont->_fntFileName.c_str());
|
||||
setText(labelBMFont->_stringValue.c_str());
|
||||
setFntFile(labelBMFont->_fntFileName);
|
||||
setText(labelBMFont->_stringValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,18 +11,13 @@ bool UITextBMFontTest::init()
|
|||
{
|
||||
Size widgetSize = _widget->getSize();
|
||||
|
||||
Text* alert = Text::create();
|
||||
alert->setText("TextBMFont");
|
||||
alert->setFontName("fonts/Marker Felt.ttf");
|
||||
alert->setFontSize(30);
|
||||
Text* alert = Text::create("TextBMFont","TextBMFont",30);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 1.75f));
|
||||
_uiLayer->addChild(alert);
|
||||
|
||||
// Create the TextBMFont
|
||||
TextBMFont* textBMFont = TextBMFont::create("BMFont", "cocosui/bitmapFontTest2.fnt");
|
||||
// textBMFont->setFntFile("cocosui/bitmapFontTest2.fnt");
|
||||
// textBMFont->setText("BMFont");
|
||||
textBMFont->setPosition(Point(widgetSize.width / 2, widgetSize.height / 2.0f + textBMFont->getSize().height / 8.0f));
|
||||
_uiLayer->addChild(textBMFont);
|
||||
|
||||
|
|
Loading…
Reference in New Issue