cocos2d-x 3.1.1 学习笔记[13] listen 监听器
文章出自于 http://blog.csdn.net/zhouyunxuan
//创建监听器
auto listen = EventListenerTouchOneByOne::create();
listen->setSwallowTouches(false);
listen->onTouchBegan = [](Touch* touch, Event* event){
auto target = static_cast<Sprite*>(event->getCurrentTarget());
if(target->getBoundingBox().containsPoint(touch->getLocation()))
{
return true;
}
return false;
};
listen->onTouchMoved = [](Touch* touch,Event* event){
// 获取事件所绑定的 target
auto target = static_cast<Sprite*>(event->getCurrentTarget());
if (target->getBoundingBox().containsPoint(touch->getLocation())) {
target->setPosition(target->getPosition() + touch->getDelta());
}
};
listen->onTouchEnded = [=](Touch* touch, Event* event){};
cocos2d-x 3.1.1 学习笔记[13] listen 监听器的更多相关文章
- [XMPP]iOS聊天软件学习笔记[一]
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- cocos2d-x 3.1.1学习笔记[23]寻找主循环 mainloop
文章出自于 http://blog.csdn.net/zhouyunxuan cocos2d到底是怎样把场景展示给我们的,我一直非常好奇. 凭个人猜想,引擎内部的结构类似于这样 while(true ...
- cocos2d-x 3.1.1 学习笔记[3]Action 动作
这些动画貌似都非常多的样子,就所有都创建一次. 代码例如以下: /* 动画*/ auto sp = Sprite::create("card_bg_big_26.jpg"); Si ...
- cocos2d-x 3.1.1 学习笔记[2]Sprite 精灵
Sprite应该是用到最多的一个类吧.无法想像一个游戏没有精灵将怎样进行愉快的玩耍. Sprite继承于Node 和 TextureProtocol. Sprite是一个2d的图像. Sprite能够 ...
- cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程
文章出自于 http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...
- cocos2d-x 3.1.1 学习笔记[4]GridActions 网格动画
文章写的 http://blog.csdn.net/zhouyunxuan 老样子.见代码. //GridActions can only used on NodeGrid auto nodeGri ...
- cocos2d-x 3.1.1 学习笔记[11] http请求 + json解析
//http须要引入的头文件和命名空间 #include <network/HttpClient.h> using namespace network; //json须要引入的头文件 #i ...
- [XMPP]iOS聊天软件学习笔记[四]
昨天完成了聊天界面,基本功能算告一段落 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework git clone https://githu ...
- [XMPP]iOS聊天软件学习笔记[三]
今天做了好友界面,其实xmpp内部已经写好很多扩展模块,所以使用起来还是很方便的 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework gi ...
随机推荐
- python在windows通过安装模块错误
我的环境是win7+vs2013+python3.2,他们是32地点 windows通过安装模块错误 1)Unable to find vcvarsall.bat : 打开"<pyth ...
- hdu4362 dp + 单调队列优化
dp传输方程很easy需要 dp[i][j] = min{dp[i - 1][k] + abs(pos[i][j] -pos[i - 1][j]) + cost[i][j]} n行m一排 每个传输扫描 ...
- 【转】JAVA Socket用法详解
一.构造Socket Socket的构造方法有以下几种重载形式: (1)Socket() (2)Socket(InetAddress address, int port)throws UnknownH ...
- MVC简单的认识
学习一个新知识,首先要了解的就是以下几个问题,它是什么?它能干什么?使用它有什么优点?这篇文章就环绕这几个问题来展开讨论. mvc不是一种编程语言,严格来说.它都不算是一门技术.它是开发软件时使用的一 ...
- ERROR 2003 (HY000): Can't connect to MySQL server on '10.16.115.101' (111)
ubuntu安装之后mysql,使用apt-get安装命令,默认为同意只本地访问 root@idata1:~/software# mysql -uroot -p123456 -h10.16.115.1 ...
- strchr,wcschr 及strrchr, wcsrchr,_tcschr,_tcsrchr函数
strchr,wcschr 及strrchr, wcsrchr,_tcschr,_tcsrchr函数 (1) char *strchr( const char *string, int ...
- [ExtJS5学习笔记]第22 Extjs5正在使用beforeLabelTpl添加所需的配置选项标注星号标记
本文地址:http://blog.csdn.net/sushengmiyan/article/details/39395753 官方样例:http://docs.sencha.com/extjs/5. ...
- “采用VS2010至MFC4.2发育”最后溶液
我层2010年这方面的研究进行了简单(http://blog.csdn.net/boweirrking/article/details/5477062),那时候没有深入思考过这当中的原理,最终给出的方 ...
- 在InstallShield中发布单一的Setup.exe文件
原文:在InstallShield中发布单一的Setup.exe文件 InstallShield默认的Release模式下,生成了一个setup.exe文件,一个msi文件,以及一些其它的杂项文件. ...
- Android项目外接高德地图代码混淆注意事项
如今好多项目中都加入了第三方jar包,可是最大的问题就是打包的时候代码混淆报错,下面是高德地图混淆报错解决方式: 在proguard-project.txt中加入例如以下代码: -libraryjar ...