2013-12-23 15:35:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "UIWidgetAddNodeTest.h"
|
|
|
|
|
|
|
|
|
|
|
|
// UIWidgetAddNodeTest
|
|
|
|
|
|
|
|
UIWidgetAddNodeTest::UIWidgetAddNodeTest()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIWidgetAddNodeTest::~UIWidgetAddNodeTest()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UIWidgetAddNodeTest::init()
|
|
|
|
{
|
|
|
|
if (UIScene::init())
|
|
|
|
{
|
2014-06-20 11:18:53 +08:00
|
|
|
Size widgetSize = _widget->getContentSize();
|
2014-03-04 17:06:12 +08:00
|
|
|
|
|
|
|
// Add the alert
|
|
|
|
Text* alert = Text::create();
|
2014-05-14 15:26:14 +08:00
|
|
|
alert->setString("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-06-20 11:18:53 +08:00
|
|
|
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 1.75));
|
2014-03-04 17:06:12 +08:00
|
|
|
_uiLayer->addChild(alert);
|
|
|
|
|
|
|
|
// Create the ui node container
|
|
|
|
Widget* widget = Widget::create();
|
2014-05-15 01:07:09 +08:00
|
|
|
widget->setPosition(Vec2(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-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(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
|
|
|
}
|