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

Method DrawNodeAxmolTest2

tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp:3273–3304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3271}
3272
3273DrawNodeAxmolTest2::DrawNodeAxmolTest2()
3274{
3275 selectedRadioButton = 0;
3276
3277 _radioButtonGroup = ui::RadioButtonGroup::create();
3278 addChild(_radioButtonGroup, 50);
3279
3280 static const float BUTTON_WIDTH = 30;
3281 static float startPosX = 0;
3282
3283 // Create the radio buttons
3284 static const int NUMBER_OF_BUTTONS = 2;
3285 startPosX = size.width / 2.0f - ((NUMBER_OF_BUTTONS - 1) / 2.0f) * BUTTON_WIDTH;
3286 for (int i = 0; i < NUMBER_OF_BUTTONS; ++i)
3287 {
3288 ui::RadioButton* radioButton =
3289 ui::RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
3290 float posX = startPosX + BUTTON_WIDTH * i;
3291 radioButton->setPosition(Vec2(posX, size.height - 80));
3292 radioButton->setScale(1.2f);
3293 radioButton->setTag(i);
3294 _radioButtonGroup->addRadioButton(radioButton);
3295 addChild(radioButton, 50);
3296 radioButton->addEventListener(AX_CALLBACK_2(DrawNodeAxmolTest2::onChangedRadioButtonSelect, this));
3297 }
3298
3299 drawNode = DrawNode::create();
3300 drawNode->properties.setTransform(true);
3301 addChild(drawNode, 10);
3302
3303 scheduleUpdate();
3304}
3305
3306void DrawNodeAxmolTest2::onChangedRadioButtonSelect(ui::RadioButton* radioButton, ui::RadioButton::EventType type)
3307{

Callers

nothing calls this directly

Calls 9

createFunction · 0.85
scheduleUpdateFunction · 0.85
setTagMethod · 0.80
setTransformMethod · 0.80
Vec2Function · 0.50
setPositionMethod · 0.45
setScaleMethod · 0.45
addRadioButtonMethod · 0.45
addEventListenerMethod · 0.45

Tested by

no test coverage detected