2013-12-23 15:35:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "UIWidgetAddNodeTest.h"
|
|
|
|
|
|
|
|
|
|
|
|
// UIWidgetAddNodeTest
|
|
|
|
|
|
|
|
UIWidgetAddNodeTest::UIWidgetAddNodeTest()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIWidgetAddNodeTest::~UIWidgetAddNodeTest()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIWidgetAddNodeTest::init()
|
|
|
|
{
|
|
|
|
if (UIScene::init())
|
|
|
|
{
|
2014-03-04 17:06:12 +08:00
|
|
|
Size widgetSize = _widget->getSize();
|
|
|
|
|
|
|
|
// Add the alert
|
|
|
|
Text* alert = Text::create();
|
|
|
|
alert->setText("Widget Add Node");
|
2014-03-26 23:33:58 +08:00
|
|
|
alert->setFontName("fonts/Marker Felt.ttf");
|
2014-03-04 17:06:12 +08:00
|
|
|
alert->setFontSize(30);
|
|
|
|
alert->setColor(Color3B(159, 168, 176));
|
2014-04-15 18:23:40 +08:00
|
|
|
alert->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 1.75));
|
2014-03-04 17:06:12 +08:00
|
|
|
_uiLayer->addChild(alert);
|
|
|
|
|
|
|
|
// Create the ui node container
|
|
|
|
Widget* widget = Widget::create();
|
2014-04-15 18:23:40 +08:00
|
|
|
widget->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
2014-03-04 17:06:12 +08:00
|
|
|
_uiLayer->addChild(widget);
|
|
|
|
|
2014-03-11 17:13:54 +08:00
|
|
|
Sprite* sprite = Sprite::create("cocosui/ccicon.png");
|
2014-04-15 18:23:40 +08:00
|
|
|
sprite->setPosition(Vector2(0, sprite->getBoundingBox().size.height / 4));
|
2014-03-24 15:25:44 +08:00
|
|
|
widget->addChild(sprite);
|
2013-12-23 15:35:35 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2014-03-11 17:13:54 +08:00
|
|
|
}
|