MCPcopy Create free account
hub / github.com/axmolengine/axmol / initSliders

Method initSliders

tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp:1606–1638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1604}
1605
1606void DrawNodeBaseTest::initSliders()
1607{
1608 _currentSeletedItemIndex = 0;
1609
1610 std::string text[sliderType::sliderTypeLast] = {"AngleStart", "AngleEnd", "Rotation", "Thickness"};
1611
1612 auto ttfConfig = TTFConfig("fonts/arial.ttf", 5);
1613 for (int i = 0; i < (sliderType::sliderTypeLast); i++)
1614 {
1615 slider[i] = ax::ui::Slider::create();
1616 slider[i]->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
1617 slider[i]->loadBarTexture("cocosui/sliderTrack.png");
1618 slider[i]->loadSlidBallTextures("ccs-res/cocosui/sliderballnormal.png", "ccs-res/cocosui/sliderballpressed.png",
1619 "");
1620 slider[i]->loadProgressBarTexture("cocosui/sliderProgress.png");
1621 slider[i]->setPosition(Vec2(size.width - slider[i]->getContentSize().x / 2 - 10, size.height / 6 + i * 16));
1622 slider[i]->setPercent(sliderValue[i]);
1623
1624 slider[i]->setEnabled(false);
1625 slider[i]->setScale(0.5f);
1626 addChild(slider[i], 20);
1627
1628 sliderLabel[i] = Label::createWithTTF(ttfConfig, text[i] + ": (" + Value(sliderValue[i]).asString() + ")");
1629 sliderLabel[i]->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
1630 sliderLabel[i]->setPosition(slider[i]->getPosition() + Vec2(0, 8));
1631 addChild(sliderLabel[i], 20);
1632 }
1633
1634 slider[sliderType::AngleStart]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeStartAngle, this));
1635 slider[sliderType::AngleEnd]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeEndAngle, this));
1636 slider[sliderType::Rotation]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeRotation, this));
1637 slider[sliderType::Thickness]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeThickness, this));
1638}
1639
1640DrawNodeMorphTest_SolidPolygon::DrawNodeMorphTest_SolidPolygon()
1641{

Callers

nothing calls this directly

Calls 15

createFunction · 0.85
loadBarTextureMethod · 0.80
loadSlidBallTexturesMethod · 0.80
asStringMethod · 0.80
Vec2Function · 0.50
ValueClass · 0.50
setAnchorPointMethod · 0.45
setPositionMethod · 0.45
getContentSizeMethod · 0.45
setPercentMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected