当前位置: 首页>>代码示例>>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;未经允许,请勿转载。