本文整理汇总了C++中CLOSURE函数的典型用法代码示例。如果您正苦于以下问题:C++ CLOSURE函数的具体用法?C++ CLOSURE怎么用?C++ CLOSURE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CLOSURE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initActor
GameScene::GameScene()
{
//create game actor
_game = new Game;
_game->init();
_game->attachTo(_view);
//Game Actor would have own Clock.
//clock is internal time of each Actor
//by default own clock has only Stage
//clock could be paused and all children of this Actor would be paused to
_game->setClock(new Clock);
//create menu button
spActor btn = initActor(new MyButton,
arg_resAnim = res::ui.getResAnim("menu"),
arg_anchor = Vector2(0.5f, 0.5f),
arg_attachTo = _view);
//align it to top right
btn->setX(_view->getWidth() - btn->getWidth()/2);
btn->setY(btn->getHeight()/2);
//handle click to menu
btn->addEventListener(TouchEvent::CLICK, CLOSURE(this, &GameScene::onEvent));
//subscribe to Hidden Event from GameMenu
GameMenu::instance->addEventListener(GameScene::HiddenEvent::EVENT, CLOSURE(this, &GameScene::onEvent));
}
示例2: CLOSURE
void DebugActor::onAdded2Stage()
{
_dragging = false;
_stage->addEventListener(TouchEvent::MOVE, CLOSURE(this, &DebugActor::onDAEvent));
_stage->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onDAEvent));
_stage->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &DebugActor::onDAEvent));
}
示例3: addEventListener
MyButton::MyButton()
{
//pressed button should be RED
addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &MyButton::onEvent));
addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &MyButton::onEvent));
addEventListener(TouchEvent::CLICK, CLOSURE(this, &MyButton::onEvent));
}
示例4: _getStage
void DebugActor::showTouchedActor(bool show)
{
_getStage()->removeEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onEvent));
_showTouchedActor = show;
if (show)
_getStage()->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onEvent));
spActor btn = getChild("finger");
}
示例5: setTouchChildrenEnabled
MyButton::MyButton()
{
setTouchChildrenEnabled(false);
//pressed button should be RED
addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &MyButton::onEvent));
addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &MyButton::onEvent));
addEventListener(TouchEvent::CLICK, CLOSURE(this, &MyButton::onEvent));
}
示例6: destroy
void Draggable::init(Actor* actor)
{
destroy();
_singleDrag = false;
_actor = actor;
_dragClient = actor;
actor->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &Draggable::onEvent));
actor->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Draggable::onEvent));
}
示例7: getRoot
void DebugActor::showTouchedActor(bool show)
{
getRoot()->removeEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onEvent));
_showTouchedActor = show;
if (show)
getRoot()->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onEvent));
spActor btn = getChild("finger");
btn->removeTweens(true);
if (show)
btn->addTween(Actor::TweenAlpha(0), 300, 999999, true);
}
示例8: addRef
void WebImage::load(const std::string& url)
{
_image->setResAnim(0);
_http = HttpRequestTask::create();
if (!_http)
return;
_http->setUrl(url);
_http->run();
addRef();//protect actor for delete
_http->addEventListener(AsyncTask::COMPLETE, CLOSURE(this, &WebImage::loaded));
_http->addEventListener(AsyncTask::ERROR, CLOSURE(this, &WebImage::error));
}
示例9: _sliding
SlidingActor::SlidingActor():
_sliding(false),
_rad(_defaultTouchThreshold),
_maxSpeed(250),
_downTime(0),
_lastTime(0), _current(0), _lastIterTime(0)
{
_clip = new ClipRectActor;
_clip->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &SlidingActor::_newEvent));
_clip->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &SlidingActor::_newEvent));
_clip->addEventListener(TouchEvent::MOVE, CLOSURE(this, &SlidingActor::_newEvent));
addChild(_clip);
}
示例10: e2fd
value* e2fd(value* in)
{
value a;
CLOSURE ("e2fd");
a = caml_callback(*closure, *in);
return fcl_wrap(a);
}
示例11: fd2e
value* fd2e(value* in)
{
value a;
CLOSURE ("fd2e");
a = caml_callback(*closure, *in);
return fcl_wrap(a);
}
示例12: arith_mul
value* arith_mul(value* val1, value* val2)
{
value a;
CLOSURE("arith_mul");
a = caml_callback2(*closure, *val1, *val2);
return fcl_wrap(a);
}
示例13: swap
spTween Jewel::swap(const Vector2& pos)
{
_swaping = true;
spTween tween = _view->addTween(Actor::TweenPosition(pos), 500);
tween->addDoneCallback(CLOSURE(this, &Jewel::swapped));
return tween;
}
示例14: sorting_sort
value* sorting_sort(value* in)
{
value a;
CLOSURE ("Sorting.sort");
a = caml_callback(*closure, *in);
return fcl_wrap(a);
}
示例15: interval_ismember
value* interval_ismember(value* in, int inf, int sup)
{
value a;
CLOSURE ("Interval.is_member");
a = caml_callback3(*closure, *in, Val_int(inf), Val_int(sup));
return fcl_wrap(a);
}