issue #4636, finish UITextBMFont

This commit is contained in:
andyque 2014-04-03 15:45:06 +08:00
parent 08bf6c27f4
commit ed2c38eb98
2 changed files with 4 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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);