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
-
accelerometerEnabled
whether or not it will receive Accelerometer events You can enable / disable accelerometer events with this property.
property -
touchEnabled
whether or not it will receive Touch events
property -
touchPriority
priority of the touch events. Default is 0
property -
touchMode
Touch 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.
-
gestureEnabled
whether or not it will receive gesture events.
property -
gesturePriority
priority of the gesture events. Default is 0
property -
mouseEnabled
whether or not it will receive mouse events.
property -
mousePriority
priority of the mouse events. Default is 0
property -
keyboardEnabled
whether or not it will receive keyboard events.
property -
keyboardPriority
Priority of keyboard events. Default is 0
property
Other 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]; }
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 accelerometerEnabled
Availability
Discussion
Valid only on iOS. Not valid on Mac.
Declared In
CCLayer.h
gestureEnabled
whether or not it will receive gesture events.
@property (nonatomic, readwrite, getter=isGestureEnabled) BOOL gestureEnabled
Declared In
CCLayer.h
gesturePriority
priority of the gesture events. Default is 0
@property (nonatomic, assign) NSInteger gesturePriority
Declared In
CCLayer.h
keyboardEnabled
whether or not it will receive keyboard events.
@property (nonatomic, readwrite, getter=isKeyboardEnabled) BOOL keyboardEnabled
Discussion
Valid only on OS X. Not valid on iOS
Declared In
CCLayer.h
keyboardPriority
Priority of keyboard events. Default is 0
@property (nonatomic, assign) NSInteger keyboardPriority
Declared In
CCLayer.h
mouseEnabled
whether or not it will receive mouse events.
@property (nonatomic, readwrite, getter=isMouseEnabled) BOOL mouseEnabled
Discussion
Valid only on OS X. Not valid on iOS
Declared In
CCLayer.h
mousePriority
priority of the mouse events. Default is 0
@property (nonatomic, assign) NSInteger mousePriority
Declared In
CCLayer.h
touchEnabled
whether or not it will receive Touch events
@property (nonatomic, assign, getter=isTouchEnabled) BOOL touchEnabled
Availability
Declared In
CCLayer.h
Instance 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)registerWithTouchDispatcher
Availability
Declared In
CCLayer.h