cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
CCLayer Class Reference

#import <CCLayer.h>

+ Inheritance diagram for CCLayer:
+ Collaboration diagram for CCLayer:

List of all members.

Public Member Functions

(void) - setAccelerometerInterval:
(void) - setIsTouchEnabled:
(void) - setIsAccelerometerEnabled:

Protected Attributes

BOOL _touchEnabled
NSInteger _touchPriority
BOOL _touchMode
BOOL _accelerometerEnabled


BOOL accelerometerEnabled
BOOL touchEnabled
NSInteger touchPriority
ccTouchesMode touchMode

Detailed Description

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

Member Function Documentation

- (void) setAccelerometerInterval: (float)  interval

sets the accelerometer's update frequency. A value of 1/2 means that the callback is going to be called twice per second.


Property Documentation

- (BOOL) accelerometerEnabled [read, write, assign]

whether or not it will receive Accelerometer events You can enable / disable accelerometer events with this property.

Valid only on iOS. Not valid on Mac.

- (BOOL) touchEnabled [read, write, assign]

whether or not it will receive Touch events

- (ccTouchesMode) touchMode [read, write, assign]

Touch modes.

  • kCCTouchesAllAtOnce: Receives all the available touches at once.
  • kCCTouchesOneByOne: Receives one touch at the time.
- (NSInteger) touchPriority [read, write, assign]

priority of the touch events. Default is 0

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