Public Member Functions

CCNode(CC3) Class Reference

Extension category to support cocos3d functionality. More...

#import <CC3CC2Extensions.h>

List of all members.

Public Member Functions

(BOOL) - cc3ContainsTouchPoint:
(CGPoint) - cc3ConvertNodePointToUISpace:
(CGPoint) - cc3ConvertUIMovementToNodeSpace:
(CGPoint) - cc3ConvertUIPointToNodeSpace:
(BOOL) - cc3IsTouchEnabled
(CGPoint) - cc3NormalizeUIMovement:
(BOOL) - cc3ValidateGesture:
(BOOL) - cc3WillConsumeTouchEventAt:
(CGRect) - globalBoundingBoxInPixels
(void) - updateViewport

Detailed Description

Extension category to support cocos3d functionality.


Member Function Documentation

- (BOOL) cc3ContainsTouchPoint: (CGPoint)  viewPoint

Returns whether this node contains the specified UI touch location.

- (CGPoint) cc3ConvertNodePointToUISpace: (CGPoint)  glPoint

Returns a point in the coordinate space of the UIView that corresponds to the specified point in the coordinate space of this node, taking into consideration the orientation of the device.

This method performs the inverse of the operation provided by the cc3ConvertUIPointToNodeSpace: method.

- (CGPoint) cc3ConvertUIMovementToNodeSpace: (CGPoint)  uiMovement

Returns a movement in the coordinate space of this layer that corresponds to the specified movement in the coordinate space of the UIView, taking into consideration the orientation of the device.

You can use this method to convert movements in a UIView, including those returned by touch events and gestures, such as the translationInView: and velocityInView: methods of UIPanGestureRecognizer, to movement in this layer.

- (CGPoint) cc3ConvertUIPointToNodeSpace: (CGPoint)  viewPoint

Returns a point in the coordinate space of this node that corresponds to the specified point in the coordinate space of the UIView, taking into consideration the orientation of the device.

You can use this method to convert locations in a UIView, including those returned by touch events and gestures, such as the locationInView: method on tap and long-press gestures, to a location in this layer.

- (BOOL) cc3IsTouchEnabled

Returns whether this node will receive touch events.

This implementation returns NO.

- (CGPoint) cc3NormalizeUIMovement: (CGPoint)  uiMovement

Normalizes the specified movement, which is in the coordinate space of the UIView, so that the movement is made relative to the size of this node.

The returned value is a fraction proportional to the size of this node. A drag movement from one side of the node all the way to the other side would return positive or negative one in the X or Y component of the returned point. Similarly, a drag movement from the center to one side would return 0.5 in the X or Y component of the returned point.

This method allows you to convert drag movements to a measurement that is independent of the absolute size of the node, and is of a scale useful for processing as input that is not used as a direct positioning value.

You can use this method to normalize movements in a UIView, including those returned by touch events and gestures, such as the translationInView: and velocityInView: methods of UIPanGestureRecognizer, so that they are proportional, and independent of, the size of this node.

This method takes into consideration the orientation of the device.

- (BOOL) cc3ValidateGesture: (UIGestureRecognizer *)  gesture

Validates that the specified gesture is okay to proceed, and cancels the gesture if not.

Returns YES if the gesture is valid and okay to proceed. Returns NO if the gesture was cancelled.

Your gesture handling callback methods should use this method before processing the gesture to ensure that there are no conflicts between the touch events of the gesture and the touch events handled by this node or any of its descendants.

For discrete gestures, such as tap gestures, you should use this method each time the callback is invoked. For many discrete gestures, the callback is only invoked when the gesture is in state UIGestureRecognizerStateEnded.

For continuous gestures, such as pan or pinch gestures, you should use this method when the callback is invoked and the gesture is in state UIGestureRecognizerStateBegan. You do not need to revalidate the continuous gesture on each subsequent callback, when the state of the gesture is UIGestureRecognizerStateChanged. Doing so is unnecessary.

This implementation extracts the location of the touch point from the gesture and uses the cc3WillConsumeTouchEventAt: method of this node to test if this node or any of its descendants are interested in the touch event that triggerd the gesture.

If neither this node nor any descendant is interested in the touch event, this method returns YES. If this node or a descendant is interested in the touch event, the gesture is cancelled and this method returns NO.

- (BOOL) cc3WillConsumeTouchEventAt: (CGPoint)  viewPoint

Returns whether this node, or any of its descendants will consume a touch event at the specified UIView location when presented with the event.

This method is useful for testing whether a touch event should be handled by a descendant node instead of a gesture recognizer. The result of this method can be used to cancel the gesture recognizer.

Based on cocos2d Gesture Recognizer ideas by Krzysztof Zabłocki at: http://www.merowing.info/2012/03/using-gesturerecognizers-in-cocos2d/

- (CGRect) globalBoundingBoxInPixels

Returns the bounding box of this CCNode, measured in pixels, in the global coordinate system.

- (void) updateViewport

Updates the viewport of any contained CC3Scene instances with the dimensions of its CC3Layer and the device orientation.

This CCNode implementation simply passes the notification along to its children. Descendants that are CC3Layers will update their CC3Scene instances.


The documentation for this class was generated from the following file: