當前位置: 首頁>>代碼示例>>C++>>正文


C++ CLOSURE函數代碼示例

本文整理匯總了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));
}
開發者ID:luiseduardohdbackup,項目名稱:oxygine-framework,代碼行數:29,代碼來源:GameScene.cpp

示例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));
 }
開發者ID:Yahor10,項目名稱:oxygine-framework,代碼行數:7,代碼來源:DebugActor.cpp

示例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));
}
開發者ID:pixelpicosean,項目名稱:lesser-panda-oxygine,代碼行數:7,代碼來源:MyButton.cpp

示例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");
    }
開發者ID:pixelpicosean,項目名稱:lesser-panda-oxygine,代碼行數:9,代碼來源:DebugActor.cpp

示例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));
}
開發者ID:oxygine,項目名稱:oxygine-game,代碼行數:10,代碼來源:MyButton.cpp

示例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));
    }
開發者ID:ivlevAstef,項目名稱:PrototypeCarGame,代碼行數:11,代碼來源:Draggable.cpp

示例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);
	}
開發者ID:huangyt,項目名稱:oxygine-framework,代碼行數:12,代碼來源:DebugActor.cpp

示例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));
    }
開發者ID:Yahor10,項目名稱:oxygine-framework,代碼行數:14,代碼來源:WebImage.cpp

示例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);
    }
開發者ID:HaoDongGuo,項目名稱:oxygine-framework,代碼行數:14,代碼來源:SlidingActor.cpp

示例10: e2fd

value* e2fd(value* in)
{
  value a;
  CLOSURE ("e2fd");
  a = caml_callback(*closure, *in);
  return fcl_wrap(a);
}
開發者ID:xoolive,項目名稱:facile,代碼行數:7,代碼來源:interface_c.c

示例11: fd2e

value* fd2e(value* in)
{
  value a;
  CLOSURE ("fd2e");
  a = caml_callback(*closure, *in);
  return fcl_wrap(a);
}
開發者ID:xoolive,項目名稱:facile,代碼行數:7,代碼來源:interface_c.c

示例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);
}
開發者ID:xoolive,項目名稱:facile,代碼行數:7,代碼來源:interface_c.c

示例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;
}
開發者ID:pixelpicosean,項目名稱:lesser-panda-oxygine,代碼行數:7,代碼來源:Jewel.cpp

示例14: sorting_sort

value* sorting_sort(value* in)
{
  value a;
  CLOSURE ("Sorting.sort");
  a = caml_callback(*closure, *in);
  return fcl_wrap(a);
}
開發者ID:xoolive,項目名稱:facile,代碼行數:7,代碼來源:interface_c.c

示例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);
}
開發者ID:xoolive,項目名稱:facile,代碼行數:7,代碼來源:interface_c.c


注:本文中的CLOSURE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。