本文整理汇总了C++中ControlButton::setZoomOnTouchDown方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlButton::setZoomOnTouchDown方法的具体用法?C++ ControlButton::setZoomOnTouchDown怎么用?C++ ControlButton::setZoomOnTouchDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlButton
的用法示例。
在下文中一共展示了ControlButton::setZoomOnTouchDown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool UndercoverGameScene::init()
{
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
ControlButton* back = ControlButton::create("Back", "Arial", 40);
back->addTargetWithActionForControlEvents(this, cccontrol_selector(UndercoverGameScene::buttonBack), Control::EventType::TOUCH_UP_INSIDE);
back->setAnchorPoint(Point(0.5,0.5));
back->setZoomOnTouchDown(true);
back->setPosition(Vec2(visibleSize.width - 100,
visibleSize.height - 100));
this->addChild(back, 1);
return true;
}
示例2: createBtn
ControlButton * createBtn(float x, float y,
const char * normalBg, const char * pressBg,
Ref* target, Control::Handler action)
{
Scale9Sprite * spNormalBg = createDotaScale9Sprite(normalBg);
Scale9Sprite * spPressBg = createDotaScale9Sprite(pressBg);
ControlButton *btn = ControlButton::create(spNormalBg);
if (spPressBg)
btn->setBackgroundSpriteForState(spPressBg, Control::State::HIGH_LIGHTED);
btn->setAnchorPoint(Vec2(0, 0));
btn->setPosition(x, y);
btn->setZoomOnTouchDown(false);
btn->setPreferredSize(spNormalBg->getOriginalSize());
if (target && action)
btn->addTargetWithActionForControlEvents(target, action,
Control::EventType::TOUCH_UP_INSIDE);
return btn;
}