From ed2c38eb9851bc9ae75cf793894c59f03ed183a5 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 3 Apr 2014 15:45:06 +0800 Subject: [PATCH] issue #4636, finish UITextBMFont --- cocos/ui/UITextBMFont.cpp | 6 +++--- .../UITextBMFontTest/UITextBMFontTest.cpp | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cocos/ui/UITextBMFont.cpp b/cocos/ui/UITextBMFont.cpp index 6574d3ee20..85b893fa9f 100644 --- a/cocos/ui/UITextBMFont.cpp +++ b/cocos/ui/UITextBMFont.cpp @@ -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(widget); if (labelBMFont) { - setFntFile(labelBMFont->_fntFileName.c_str()); - setText(labelBMFont->_stringValue.c_str()); + setFntFile(labelBMFont->_fntFileName); + setText(labelBMFont->_stringValue); } } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp index 95f2081358..3af4948c3f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp @@ -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);