CCLayer Class Reference
| Inherits from | CCNode : NSObject |
| Conforms to | CCAccelerometerDelegate CCStandardTouchDelegate CCTargetedTouchDelegate CCTouchAllAtOnceDelegate CCTouchOneByOneDelegate UIAccelerometerDelegate |
| Declared in | CCLayer.h |
Overview
CCLayer is a subclass of CCNode that implements the CCTouchEventsDelegate protocol.
All features from CCNode are valid, plus the following new features: – It can receive Touches both on iOS and Mac – It can receive Accelerometer input on iOS – It can receive Keyboard events on Mac – It can receive Mouse events on Mac
Tasks
Other Methods
-
accelerometerEnabledwhether or not it will receive Accelerometer events You can enable / disable accelerometer events with this property.
property -
touchEnabledwhether or not it will receive Touch events
property -
touchPrioritypriority of the touch events. Default is 0
property -
touchModeTouch modes.
property- kCCTouchesAllAtOnce: Receives all the available touches at once. - kCCTouchesOneByOne: Receives one touch at the time. -
– setAccelerometerInterval:sets the accelerometer’s update frequency. A value of ½ means that the callback is going to be called twice per second.
-
gestureEnabledwhether or not it will receive gesture events.
property -
gesturePrioritypriority of the gesture events. Default is 0
property -
mouseEnabledwhether or not it will receive mouse events.
property -
mousePrioritypriority of the mouse events. Default is 0
property -
keyboardEnabledwhether or not it will receive keyboard events.
property -
keyboardPriorityPriority of keyboard events. Default is 0
property
Other Methods
-
– registerWithTouchDispatcherIf isTouchEnabled, this method is called onEnter. Override it to change the way CCLayer receives touch events. ( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] ) Example:
-(void) registerWithTouchDispatcher { [[TouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:INT_MIN+1 swallowsTouches:YES]; }
AudioPanel Methods
-
– buildAudioPanel -
– buildAudioPanelWithSeparator -
– buildAudioPanelWithTSeparator -
– buildPanelSeparator -
– buildPanelTSeparator -
– panelSliderWithTarget:selector: -
– longPanelSliderWithTarget:selector: -
– addPanelTitle: -
– addPanelLine1: -
– addPanelLine2:
Deprecated Methods
-
– setIsTouchEnabled: -
– setIsAccelerometerEnabled: -
– setIsKeyboardEnabled: -
– setIsMouseEnabled: -
– mouseDelegatePriority -
– keyboardDelegatePriority -
– touchDelegatePriority
Scene Methods
Properties
accelerometerEnabled
whether or not it will receive Accelerometer events You can enable / disable accelerometer events with this property.
@property (nonatomic, assign, getter=isAccelerometerEnabled) BOOL accelerometerEnabledAvailability
Discussion
Valid only on iOS. Not valid on Mac.
Declared In
CCLayer.hgestureEnabled
whether or not it will receive gesture events.
@property (nonatomic, readwrite, getter=isGestureEnabled) BOOL gestureEnabledDeclared In
CCLayer.hgesturePriority
priority of the gesture events. Default is 0
@property (nonatomic, assign) NSInteger gesturePriorityDeclared In
CCLayer.hkeyboardEnabled
whether or not it will receive keyboard events.
@property (nonatomic, readwrite, getter=isKeyboardEnabled) BOOL keyboardEnabledDiscussion
Valid only on OS X. Not valid on iOS
Declared In
CCLayer.hkeyboardPriority
Priority of keyboard events. Default is 0
@property (nonatomic, assign) NSInteger keyboardPriorityDeclared In
CCLayer.hmouseEnabled
whether or not it will receive mouse events.
@property (nonatomic, readwrite, getter=isMouseEnabled) BOOL mouseEnabledDiscussion
Valid only on OS X. Not valid on iOS
Declared In
CCLayer.hmousePriority
priority of the mouse events. Default is 0
@property (nonatomic, assign) NSInteger mousePriorityDeclared In
CCLayer.htouchEnabled
whether or not it will receive Touch events
@property (nonatomic, assign, getter=isTouchEnabled) BOOL touchEnabledAvailability
Declared In
CCLayer.hInstance Methods
registerWithTouchDispatcher
If isTouchEnabled, this method is called onEnter. Override it to change the way CCLayer receives touch events. ( Default: [[TouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0] ) Example:
-(void) registerWithTouchDispatcher
{
[[TouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:INT_MIN+1 swallowsTouches:YES];
}
- (void)registerWithTouchDispatcherAvailability
Declared In
CCLayer.h