3.x CC_CALLBACK_*系列和2.x对比
来源:互联网 发布:java初级题目 编辑:程序博客网 时间:2024/05/01 13:03
<1>CC_CALLBACK_0
if (m_touchSp) { m_touchSp->runAction(Sequence::create(ScaleTo::create(time, 1), MoveTo::create(time, Vec2(m_destSp->getPositionX(), m_destSp->getPositionY() + spWidth)), ScaleTo::create(time, 1), CallFunc::create(CC_CALLBACK_0(GameScene::removeTouchSp, this)), NULL)); }void GameScene::removeTouchSp(){ if (m_touchSp) { m_touchSp->removeFromParent(); m_touchSp = NULL; }}
<2>CC_CALLBACK_1
animationSp->runAction(Sequence::create(MoveTo::create(time, Vec2(endPosition.x, endPosition.y - 15)), MoveTo::create(BACK_TIME, Vec2(endPosition.x, endPosition.y)), CallFuncN::create(CC_CALLBACK_1(GameScene::setSpIsTouchEnable, this)),NULL));void GameScene::setSpIsTouchEnable(Node *node){ AnimationSprite *sp = (AnimationSprite *)node; if (!sp) { return; } BubbleSprite *bubbleSp = m_bubbleMatrix[sp->getRow() * m_width + sp->getCol()]; if (bubbleSp) { return; } CloudSprite *cloudSp = m_cloudMatrix[sp->getRow() * m_width + sp->getCol()]; if (cloudSp) { return; } sp->setIsTouchEable(true);}
<3>CC_CALLBACK_2
//注册触摸事件 auto touchListener = EventListenerTouchOneByOne::create(); touchListener->onTouchBegan = CC_CALLBACK_2(GameScene::onTouchBegan, this); touchListener->onTouchMoved = CC_CALLBACK_2(GameScene::onTouchMoved, this); touchListener->onTouchEnded = CC_CALLBACK_2(GameScene::onTouchEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); //键盘事件 auto keyDiapatcher = Director::getInstance()->getEventDispatcher(); EventListenerKeyboard *keyboardListener = EventListenerKeyboard::create(); keyboardListener->onKeyPressed = CC_CALLBACK_2(GameScene::onKeyPressed, this); keyboardListener->onKeyReleased = CC_CALLBACK_2(GameScene::onKeyReleased, this); keyDiapatcher->addEventListenerWithSceneGraphPriority(keyboardListener, this);
<4>bind
_textLimitstep->runAction(Sequence::create(ScaleTo::create(0.1, 1.4), CallFunc::create(std::bind(&GameScene::setProlongStep, this)), ScaleTo::create(0.05, 1), NULL));
this->runAction(Sequence::create(DelayTime::create(0.15f), CallFunc::create(std::bind(&GameScene::afterAchieveGoal, this, 0)), NULL));
0 0
- 3.x CC_CALLBACK_*系列和2.x对比
- hadoop1.x和hadoop2.x的对比
- Axis2和Axis1.x对比
- php5.2.x php5.3.x php5.4.x php5.5.x php5.6.x 对比详解
- Struts 1.x 对比 Struts 2.x
- MapReduce1.X与2.X的对比
- python的2.x和3.x
- Spring AOP 3.x 和 2.x
- python 2.x和3.x区别
- Python3.x和Python2.x的差异对比
- hadoop之 Hadoop1.x和Hadoop2.x构成对比
- [cocos2d-x3.x学习笔记]lambda表达式 std::function CC_CALLBACK_ 事件回调实现
- Struts2 和struts1.X的对比
- CC_CALLBACK_#
- Python中字符编码的总结和对比:Python 2.x的str和unicode vs Python 3.x的bytes和str
- cocos2dx 2.x与cocos2dx 3.x类库用法对比
- 3.RxJava2.x与RxJava1.x的差异对比
- 5.Struts 1.x 对比 Struts 2.x
- MySQL 性能优化的最佳 20+ 条经验
- RYU控制器代码结构的总结
- W项目资料汇总 (转)
- 第十一周项目2 职员有薪水了
- GCD教程(二):多核心的性能
- 3.x CC_CALLBACK_*系列和2.x对比
- 又一波你可能不知道的 Linux 命令行网络监控工具
- LeetCode 13 - Roman to Integer
- 欢迎使用CSDN-markdown编辑器
- RMI、Hessian、Burlap、Httpinvoker、WebService的比较
- 30天自制操作系统 IPL
- 5.18学习笔记
- UVa 1619 Feel Good
- libcurl 使用详解