Cctouch and cctouchphase---cocos2d-swift v3.3

Source: Internet
Author: User


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 is a platform-agnostic touch event.



Note: You should never create instances of Cctouch.



You should never create a Cctouch instance.


Taskstouch Information
    •   phase Property
    •   tapCount Property
    •   timestamp Property
Associated View and Platform Touch
    •   view Property
    •   uiTouch Property
Convert Touch location to Node coordinate System
    • – locationInNode:
    • – locationInWorld
Convert Touch location to View coordinate System
    • – locationInView:
    • – previousLocationInView:
Propertiesphase


The Cctouchphase this touch was currently in.



The current stage of this touch


@property (nonatomic, readonly) CCTouchPhase phaseAvailability


v3.2 and later


Declared inCCTouch.hTapcount


The number of taps for this touch event.



Touch the number of times the event was struck.


@property (nonatomic, readonly) NSUInteger tapCountAvailability


v3.2 and later


Declared inCCTouch.hTimestamp


The timestamp of the most recent touch phase change.



The time stamp of the most recent touch stage change.


@property (nonatomic, readonly) NSTimeInterval timestampAvailability


v3.2 and later


Declared inCCTouch.hUitouch


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 *uiTouchAvailability


v3.2 and later


Discussion


Note: The Cctouchandroid class is not documented, and it is just a subset of Cctouch.


Declared inCCTouch.hView


The associated cocos2d view.



The view of the associated cocos2d


@property (nonatomic, strong) CCGLView *viewAvailability


v3.2 and later


Declared inCCTouch.hInstance Methodslocationinnode:


The node to which this touch should is relative to.



This touch event should be associated with node.


- (CGPoint)locationInNode:(CCNode *) nodeParameters Node

The node to which this touch should is relative to.

Return Value


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


Availability


v3.2 and later


Declared inCCTouch.hLocationinview:


The view to which this touch should is relative to.


- (CGPoint)locationInView:(CCGLView *) viewParameters View

The view to which this touch should is relative to.

Return Value


The touch location relative to the given view.


Availability


v3.2 and later


Declared inCCTouch.hLocationinworld


The touch location relative to the scene (aka "World").



The touch position relative to the scene.


- (CGPoint)locationInWorldReturn Value


The touch location relative to the scene (aka "World").


Availability


v3.2 and later


Declared inCCTouch.hPreviouslocationinview:


The view to which this touch should is relative to.


- (CGPoint)previousLocationInView:(CCGLView *) viewParameters View

The view to which this touch should is relative to.

Return Value


The previous touch relative to the given view.



Returns: the previous touch position relative to the given view.


Availability


v3.2 and later


Declared inCCTouch.hCctouchphase Constants Reference
Declared in CCTouch.h
Cctouchphase


Touch phases, equivalent to Uitouch phases. Used by touch events received through Ccresponder.



The touch phase is equivalent to Uitouch phases.


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

A finger just touched the screen.

Fingers just touching the screen

Declared inCCTouch.h.

CCTouchPhaseMoved

A finger on the screen just moved.

Fingers just left the screen

Declared inCCTouch.h.

CCTouchPhaseStationary

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

One finger touches the screen, but it's not gone yet.

Declared inCCTouch.h.

CCTouchPhaseEnded

A finger is lifted from the screen.

One finger out of the screen

Declared inCCTouch.h.

CCTouchPhaseCancelled

The system cancelled touch events. This can has many reasons, for instance if receiving a call and the screen goes black or a gesture recognizer Cancellin G Touch events.

The system canceled the touch event. This can be caused by a number of reasons, such as when the phone is received, the screen turns black, or gesture recognition cancels the touch event.

Declared inCCTouch.h.

Declared inCCTouch.h


Cctouch and cctouchphase---cocos2d-swift v3.3


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.