示例#1
0
void Test::addToggle(std::string id, const toggle* t, int num)
{
    spButton button = createButtonHelper(new Toggle(t, num), t[0].text, CLOSURE(this, &Test::_toggleClicked));
    initActor(button.get(),
              arg_name = id,
              arg_attachTo = ui,
              arg_anchor = Vector2(0.5f, 0.0f),
              arg_pos = Vector2(_x, _y));

    _y += button->getHeight() + 2.0f;

    if (_y + button->getHeight() >= getHeight())
    {
        _y = 0;
        _x += button->getWidth() + 70;
    }
}
示例#2
0
spButton Test::addButton(std::string id, std::string txt)
{
    spButton button = createButtonHelper(new Button, txt, CLOSURE(this, &Test::_clicked));
    initActor(button.get(),
              arg_name = id,
              arg_attachTo = ui,
              arg_anchor = Vector2(0.5f, 0.0f),
              arg_pos = Vector2(_x, _y));

    _y += button->getHeight() + 2.0f;

    if (_y + button->getHeight() >= getHeight())
    {
        _y = 0;
        _x += button->getWidth() + 70;
    }

    return button;
}
示例#3
0
Test::Test() : _color(Color::White), _txtColor(72, 61, 139, 255)
{
    setSize(getStage()->getSize());

    _x = getWidth() - 100;
    _y = 2;

    ui = new Actor;
    content = new Content;
    content->setSize(getSize());

    addChild(content);
    addChild(ui);

    if (instance)
    {
        spButton button = createButtonHelper(new Button, "back", CLOSURE(this, &Test::back));
        button->setY(getHeight() - button->getHeight());
        ui->addChild(button);
    }

    memset(_notifies, 0, sizeof(_notifies));
}