mirror of https://github.com/axmolengine/axmol.git
issue #4636. finish UIPageViewTest
This commit is contained in:
parent
48429f5738
commit
8b9af0e94c
|
@ -21,19 +21,15 @@ bool UIPageViewTest::init()
|
|||
Size widgetSize = _widget->getSize();
|
||||
|
||||
// Add a label in which the dragpanel events will be displayed
|
||||
_displayValueLabel = Text::create();
|
||||
_displayValueLabel->setText("Move by horizontal direction");
|
||||
_displayValueLabel->setFontName("fonts/Marker Felt.ttf");
|
||||
_displayValueLabel->setFontSize(32);
|
||||
_displayValueLabel = Text::create("Move by horizontal direction", "fonts/Marker Felt.ttf", 32);
|
||||
_displayValueLabel->setAnchorPoint(Point(0.5f, -1.0f));
|
||||
_displayValueLabel->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5));
|
||||
_displayValueLabel->setPosition(Point(widgetSize.width / 2.0f,
|
||||
widgetSize.height / 2.0f +
|
||||
_displayValueLabel->getContentSize().height * 1.5));
|
||||
_uiLayer->addChild(_displayValueLabel);
|
||||
|
||||
// Add the black background
|
||||
Text* alert = Text::create();
|
||||
alert->setText("PageView");
|
||||
alert->setFontName("fonts/Marker Felt.ttf");
|
||||
alert->setFontSize(30);
|
||||
Text* alert = Text::create("PageView", "fonts/Marker Felt.ttf", 30);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 3.075f));
|
||||
_uiLayer->addChild(alert);
|
||||
|
@ -44,7 +40,6 @@ bool UIPageViewTest::init()
|
|||
|
||||
// Create the page view
|
||||
PageView* pageView = PageView::create();
|
||||
pageView->setTouchEnabled(true);
|
||||
pageView->setSize(Size(240.0f, 130.0f));
|
||||
Size backgroundSize = background->getContentSize();
|
||||
pageView->setPosition(Point((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
|
@ -57,18 +52,14 @@ bool UIPageViewTest::init()
|
|||
Layout* layout = Layout::create();
|
||||
layout->setSize(Size(240.0f, 130.0f));
|
||||
|
||||
ImageView* imageView = ImageView::create();
|
||||
imageView->setTouchEnabled(true);
|
||||
ImageView* imageView = ImageView::create("cocosui/scrollviewbg.png");
|
||||
imageView->setScale9Enabled(true);
|
||||
imageView->loadTexture("cocosui/scrollviewbg.png");
|
||||
imageView->setSize(Size(240, 130));
|
||||
imageView->setPosition(Point(layout->getSize().width / 2.0f, layout->getSize().height / 2.0f));
|
||||
layout->addChild(imageView);
|
||||
|
||||
Text* label = Text::create();
|
||||
label->setText(CCString::createWithFormat("page %d", (i + 1))->getCString());
|
||||
label->setFontName("fonts/Marker Felt.ttf");
|
||||
label->setFontSize(30);
|
||||
__String *textContent = __String::createWithFormat("page %d", (i + 1));
|
||||
Text* label = Text::create(textContent->getCString(), "fonts/Marker Felt.ttf", 30);
|
||||
label->setColor(Color3B(192, 192, 192));
|
||||
label->setPosition(Point(layout->getSize().width / 2.0f, layout->getSize().height / 2.0f));
|
||||
layout->addChild(label);
|
||||
|
|
Loading…
Reference in New Issue