2013-09-16 20:54:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "UILabelAtlasTest.h"
|
|
|
|
|
|
|
|
|
|
|
|
// UILabelAtlasTest
|
|
|
|
|
|
|
|
bool UILabelAtlasTest::init()
|
|
|
|
{
|
|
|
|
if (UIScene::init())
|
|
|
|
{
|
2013-12-23 15:35:35 +08:00
|
|
|
Size widgetSize = _widget->getSize();
|
2013-09-16 20:54:13 +08:00
|
|
|
|
|
|
|
// Add the alert
|
2013-12-31 16:36:33 +08:00
|
|
|
gui::Text* alert = gui::Text::create();
|
2013-09-16 20:54:13 +08:00
|
|
|
alert->setText("LabelAtlas");
|
2013-12-23 15:35:35 +08:00
|
|
|
alert->setFontName("Marker Felt");
|
2013-09-16 20:54:13 +08:00
|
|
|
alert->setFontSize(30);
|
|
|
|
alert->setColor(Color3B(159, 168, 176));
|
2013-12-23 15:35:35 +08:00
|
|
|
alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 1.75f));
|
|
|
|
_uiLayer->addChild(alert);
|
2013-09-16 20:54:13 +08:00
|
|
|
|
|
|
|
// Create the label atlas
|
2013-12-31 16:36:33 +08:00
|
|
|
gui::TextAtlas* labelAtlas = gui::TextAtlas::create();
|
2013-09-16 20:54:13 +08:00
|
|
|
labelAtlas->setProperty("1234567890", "cocosgui/labelatlas.png", 17, 22, "0");
|
2013-12-23 15:35:35 +08:00
|
|
|
labelAtlas->setPosition(Point((widgetSize.width) / 2, widgetSize.height / 2.0f));
|
|
|
|
_uiLayer->addChild(labelAtlas);
|
2013-09-16 20:54:13 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|