凉鞋学spritekit 实现单点触摸/触控
来源:互联网 发布:广州电脑锣编程培训 编辑:程序博客网 时间:2024/04/27 21:02
发现spritekit没有提供单点触控的解决方案
今天看NSObject的时候看到个hash,返回的是个NSUInteger值,就有了如下思路:
其中touchHash 是成员变量,类型为NSUInteger;
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (touchHash != 0) return; UITouch *touch = [touches anyObject]; CGPoint rightPosition = [touch locationInNode:self]; NSLog(@"%ud",[touch hash]); touchHash = [touch hash];}-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = NULL; for (UITouch *t in touches) { if ([t hash] == touchHash) { touch = t; } } if (touch == NULL) { return; } NSLog(@"%ud",[touch hash]);}-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = NULL; for (UITouch *t in touches) { if ([t hash] == touchHash) { touch = t; } }
if (touch == NULL) { return; }
touchHash = 0;
NSLog(@"%ud",[touch hash]);}
0 0
- 凉鞋学spritekit 实现单点触摸/触控
- 单点触摸实现水滴效果
- 19.实现单点触摸画圆
- 单点触摸
- Cocos2d触摸:单点触摸
- Android-单点触摸-多点触摸
- Android 如何 实现 单点/多点触摸来进行图片缩放
- Cocos2d-x 单点触摸
- Cocos2d-x_单点触摸
- quick 单点触摸
- COCOS-单点触摸
- Lua_单点触摸
- EventListenerTouchOneByOne::create() 单点触摸
- 单点触摸一
- 单点触摸二
- Cocos单点触摸
- 单点触摸事件
- 单点触摸事件
- 过滤器与拦截器的具体区别
- 2012蓝桥杯C++本科 微生物繁殖
- 编程之美 2013 全国挑战赛 初赛第一场 题目二 相似字符串
- UVA 11991 Easy Problem from Rujia Liu?
- c#图像处理入门(-bitmap类和图像像素值获取方法)
- 凉鞋学spritekit 实现单点触摸/触控
- Android 中的 Service理解
- c++中的排列函数
- 实用的SharePoint2010品牌化和自定义--第一章节--SharePoint2010品牌化介绍
- 二叉搜索树的后序遍历序列
- python批量修改文件名
- allegro artwork设置和颜色设置的导入导出
- 标准C++中的string类的用法总结
- 这个关于ssh2数据库删除操作的异常是什么原因?