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

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

Deprecated Methods

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

touchMode

Touch modes.

- kCCTouchesAllAtOnce: Receives all the available touches at once.
- kCCTouchesOneByOne: Receives one touch at the time.
@property (nonatomic, assign) ccTouchesMode touchMode

Declared In

CCLayer.h

touchPriority

priority of the touch events. Default is 0

@property (nonatomic, assign) NSInteger touchPriority

Declared In

CCLayer.h

Class Methods

scene

Instance Methods

addPanelLine1:

addPanelLine2:

addPanelTitle:

buildAudioPanel

buildAudioPanelWithSeparator

buildAudioPanelWithTSeparator

buildPanelSeparator

buildPanelTSeparator

keyboardDelegatePriority

longPanelSliderWithTarget:selector:

mouseDelegatePriority

panelSliderWithTarget:selector:

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

setAccelerometerInterval:

sets the accelerometer’s update frequency. A value of ½ means that the callback is going to be called twice per second.

- (void)setAccelerometerInterval:(float)interval

Availability

Declared In

CCLayer.h

setIsAccelerometerEnabled:

setIsKeyboardEnabled:

setIsMouseEnabled:

setIsTouchEnabled:

touchDelegatePriority