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");
|
|
|
|
alert->setFontName("Marker Felt");
|
|
|
|
alert->setFontSize(30);
|
|
|
|
alert->setColor(Color3B(159, 168, 176));
|
|
|
|
alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 1.75));
|
|
|
|
_uiLayer->addChild(alert);
|
|
|
|
|
|
|
|
// Create the ui node container
|
|
|
|
Widget* widget = Widget::create();
|
|
|
|
widget->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
|
|
|
_uiLayer->addChild(widget);
|
|
|
|
|
2014-03-11 17:13:54 +08:00
|
|
|
Sprite* sprite = Sprite::create("cocosui/ccicon.png");
|
2014-03-04 17:06:12 +08:00
|
|
|
sprite->setPosition(Point(0, sprite->getBoundingBox().size.height / 4));
|
|
|
|
widget->addNode(sprite);
|
2013-12-23 15:35:35 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2014-03-11 17:13:54 +08:00
|
|
|
}
|