CCTouch和CCTouchPhase --- Cocos2D-Swift v3.3

CCTouch Class Reference

Inherits from NSObject
Declared in CCTouch.h

Overview

Thin wrapper around platform-specific touch events (ie UITouch). CCTouch is platform independent version of the touch event objects sent by iOS, Android and OS X.

CCtouch是与平台无关的touch事件。

Note: You should never create instances of CCTouch.

你永远也不应该创建一个CCTouch实例。

Tasks

Touch Information

Associated View and Platform Touch

Convert Touch Location to Node Coordinate System

Convert Touch Location to View Coordinate System

Properties

phase

The CCTouchPhase this touch is currently in.

这个触摸目前的阶段

@property (nonatomic, readonly) CCTouchPhase phase

Availability

v3.2 and later

Declared In

CCTouch.h

tapCount

The number of taps for this touch event.

触摸事件的敲击次数。

@property (nonatomic, readonly) NSUInteger tapCount

Availability

v3.2 and later

Declared In

CCTouch.h

timestamp

The timestamp of the most recent touch phase change.

最近的触摸阶段改变的时间戳。

@property (nonatomic, readonly) NSTimeInterval timestamp

Availability

v3.2 and later

Declared In

CCTouch.h

uiTouch

The associated platform-specific touch event (ie UITouch). PlatformTouch is equivalent to UITouch on iOS, CCTouchAndroid on Android and NSObject on OS X.

@property (nonatomic, strong) PlatformTouch *uiTouch

Availability

v3.2 and later

Discussion

Note: The CCTouchAndroid class is not documented, it is just a subset of CCTouch.

Declared In

CCTouch.h

view

The associated Cocos2D view.

相联系的Cocos2D的view

@property (nonatomic, strong) CCGLView *view

Availability

v3.2 and later

Declared In

CCTouch.h

Instance Methods

locationInNode:

The node to which this touch should be relative to.

这个触摸事件应该关联的node。

- (CGPoint)locationInNode:(CCNode *)node

Parameters

node

The node to which this touch should be relative to.

Return Value

The touch location relative to the given node’s position.

Availability

v3.2 and later

Declared In

CCTouch.h

locationInView:

The view to which this touch should be relative to.

- (CGPoint)locationInView:(CCGLView *)view

Parameters

view

The view to which this touch should be relative to.

Return Value

The touch location relative to the given view.

Availability

v3.2 and later

Declared In

CCTouch.h

locationInWorld

The touch location relative to the scene (aka “world”).

相对于scene的触摸位置.

- (CGPoint)locationInWorld

Return Value

The touch location relative to the scene (aka “world”).

Availability

v3.2 and later

Declared In

CCTouch.h

previousLocationInView:

The view to which this touch should be relative to.

- (CGPoint)previousLocationInView:(CCGLView *)view

Parameters

view

The view to which this touch should be relative to.

Return Value

The previous touch location relative to the given view.

返回:相对于给定的view,之前的触摸位置。

Availability

v3.2 and later

Declared In

CCTouch.h

CCTouchPhase Constants Reference

Declared in CCTouch.h

CCTouchPhase

Touch phases, equivalent to UITouch phases. Used by touch events received through CCResponder.

触摸阶段,等同于UITouch phases。

Definition

typedef NS_ENUM(NSInteger, CCTouchPhase ) {
   CCTouchPhaseBegan,
   CCTouchPhaseMoved,
   CCTouchPhaseStationary,
   CCTouchPhaseEnded,
   CCTouchPhaseCancelled,
};

Constants

CCTouchPhaseBegan

A finger just touched the screen.

手指刚刚接触屏幕

Declared In CCTouch.h.

CCTouchPhaseMoved

A finger on the screen just moved.

手指刚刚离开屏幕

Declared In CCTouch.h.

CCTouchPhaseStationary

A finger touches the screen but hasn’t moved recently.

一个手指触摸到屏幕但是还没有离开

Declared In CCTouch.h.

CCTouchPhaseEnded

A finger was lifted from the screen.

一个手指脱离了屏幕

Declared In CCTouch.h.

CCTouchPhaseCancelled

The system cancelled touch events. This can have many reasons, for instance when receiving a call and the screen goes black or a gesture recognizer cancelling touch events.

系统取消了触摸事件。这可能由多种原因造成,比如当接到电话,屏幕变黑,或者手势识别取消了触摸事件等。

Declared In CCTouch.h.

Declared In

CCTouch.h

时间: 2024-12-26 13:09:45

CCTouch和CCTouchPhase --- Cocos2D-Swift v3.3的相关文章

@最新CAX/EDA/CFD/GIS/光学/化工/液压软件资源网

最新CAX/EDA/CFD/GIS/光学/化工/液压软件资源网 阳光软件园 所有软件资料都随时更新,急需软件可以去看看,基本上能找到你想要的! http://zhangqg.51.net http://cax2one.f3322.net e-mail: [email protected];[email protected];[email protected] 将以上任意链接连接起来输入IE 窗口即可进入网站 下面是一部分软件,更多软件在我们的软件列表,如需要请到列表中去找! ACTRAN v14

好几年才收集到的软件,分享给大家。。。

QQ:365543212Email:[email protected]请按Clrt+F查找,输入软件关键字查询(不要输入版本号),如果找不到,您可以咨询客服.................FD......................12D MODEL 7.0 规划设计232Analyzer v4.1 高级串口分析监测3D Home Architect Design Suite Deluxe 8.0 室内装潢3D Profiler Tools 11.2 For Archicad 113D R

iOS 学习资料

(适合初学者) 本文资料来源于GitHub 一.视频教程(英文) Developing iOS 7 Apps for iPhone and iPad斯坦福开放教程之一, 课程主要讲解了一些 iOS 开发工具和 API 以及 iOS SDK 的使用, 属于 iOS 基础视频 iPad and iPhone Application Development该课程的讲师 Paul Hegarty 是斯坦福大学软件工程学教授, 视频内容讲解得深入, 权威, 深受好评 Advanced iPhone Dev

Cocos2d-x 物理引擎及碰撞

基础知识: 1 #ifndef __HELLOWORLD_SCENE_H__ 2 #define __HELLOWORLD_SCENE_H__ 3 4 #include "cocos2d.h" 5 6 class HelloWorld : public cocos2d::Layer 7 { 8 private: 9 Size visibleSize; 10 public: 11 // there's no 'id' in cpp, so we recommend returning t

(18)数据结构

cocos2d::Vector v3.0 beta加入 定义在"COCOS2DX_ROOT/cocos/base"的"CCVector.h"头文件中. template<class T>class CC_DLL Vector; cocos2d::Vector<T>是一个封装好的能动态增长顺序访问的容器. cocos2d::Vector<T>中的元素是按序存取的,它的低层实现数据结构是标准模版库中的标准顺序容器std::vector

精品软件3

QQ:365543212 ..................................... MAGMASOFT产品: MAGMASOFT v4.4 Windows & Linux & HPux & Solaris-ISO 1DVD(完全解密版本,无网格数量限制,可以计算的铸造仿真软件) MagmaSoft.v4.4.SP3.4-ISO 1DVD MAGMASOFT v4.4 P28-ISO 1CD Magmasoft 中文教程 MAGNA POWERTRAIN产品: AE

iOS-- (转)学习资料整理 推荐必读!!!

iOS 学习资料整理 2015-01-12 11:31 420人阅读 评论(0) 收藏 举报  分类: 其它(50)  目录(?)[+] 这份学习资料是为 iOS 初学者所准备的, 旨在帮助 iOS 初学者们快速找到适合自己的学习资料, 节省他们搜索资料的时间, 使他们更好的规划好自己的 iOS 学习路线, 更快的入门, 更准确的定位的目前所处的位置. 该文档会持续更新, 同时也欢迎更多具有丰富经验的 iOS 开发者将自己的常用的一些工具, 学习资料, 学习心得等分享上来, 我将定期筛选合并,

iOS 学习资料整理集合

视频教程(英文) Developing iOS 7 Apps for iPhone and iPad 斯坦福开放教程之一, 课程主要讲解了一些 iOS 开发工具和 API 以及 iOS SDK 的使用, 属于 iOS 基础视频 iPad and iPhone Application Development 该课程的讲师 Paul Hegarty 是斯坦福大学软件工程学教授, 视频内容讲解得深入, 权威, 深受好评 Advanced iPhone Development - Fall 2010 i

iOS 学习资料整理(转)

视频教程(英文) 视频教程(中文) 书籍 博客 文章 相关网站 社区 工具/插件 GitHub Top 50 简介 邮件订阅 文档 指南 Awesome 系列 知乎上的讨论 Quora 上的讨论 贡献者 License 这份学习资料是为 iOS 初学者所准备的, 旨在帮助 iOS 初学者们快速找到适合自己的学习资料, 节省他们搜索资料的时间, 使他们更好的规划好自己的 iOS 学习路线, 更快的入门, 更准确的定位的目前所处的位置. 该文档会持续更新, 同时也欢迎更多具有丰富经验的 iOS 开发