本文整理汇总了C++中ControlButton::setTag方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlButton::setTag方法的具体用法?C++ ControlButton::setTag怎么用?C++ ControlButton::setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlButton
的用法示例。
在下文中一共展示了ControlButton::setTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ControlButton *TDDSubMenu::createButton(const std::string &name, int tag,
const Point &pos, const Size &size)
{
Color3B colorNormal = Color3B::WHITE;
//Color3B colorSelected = colorNormal;
Scale9Sprite *bgButton = Scale9Sprite::create();
Scale9Sprite *bgHiliButton = Scale9Sprite::create();
// bgButton->setContentSize(Size(200, 50));
Label *titleButton = Label::createWithSystemFont(name.c_str(), "Arial", 15);
titleButton->setColor(colorNormal);
ControlButton *button = ControlButton::create(titleButton, bgButton);
button->setBackgroundSpriteForState(bgHiliButton, Control::State::HIGH_LIGHTED);
TDDHelper::setAlphaPremultiplied(button);
button->setTag(tag);
button->setContentSize(size);
button->setPosition(pos);
button->setSelected(false);
return button;
}
示例2: testChangeAnimation
void SpineTest::testChangeAnimation(Object *sender)
{
log("testChangeAnimation");
// Setting the Animation
SkeletonAnimation *node = SkeletonAnimation::createWithFile("player.json", "player.atlas");
node->setAnimation(0, "walk", true);
node->setPosition(Point(200, 120));
node->setTag(kTagSpinePlayer);
addChild(node);
mAnime = node;
// Setting the buttons
std::vector<Node *> nodeArray;
ControlButton *button;
button = GUIHelper::createButton("Walk", this, cccontrol_selector(SpineTest::changeAnime), Point(0, 0));
button->setTag(kTagButtonWalk);
nodeArray.push_back(button);
button = GUIHelper::createButton("Jump", this, cccontrol_selector(SpineTest::changeAnime), Point(0, 0));
button->setTag(kTagButtonJump);
nodeArray.push_back(button);
button = GUIHelper::createButton("Hurt", this, cccontrol_selector(SpineTest::changeAnime), Point(0, 0));
button->setTag(kTagButtonHurt);
nodeArray.push_back(button);
button = GUIHelper::createButton("Idle", this, cccontrol_selector(SpineTest::changeAnime), Point(0, 0));
button->setTag(kTagButtonIdle);
nodeArray.push_back(button);
GUIHelper::addNodesToParent(this, nodeArray, 0, 50, 480, 10);
// hide the menu
hideMenu();
}