Class CCLayer

#include <Geode/cocos/layers_scenes_transitions_nodes/CCLayer.h>

CCLayer is a subclass of CCNode that implements the TouchEventsDelegate protocol. All features from CCNode are valid, plus the following new features:

  • It can receive iPhone Touches
  • It can receive Accelerometer input

ℹ Robtop Addition: added CCKeyboardDelegate and CCMouseDelegate

Examples0
Public static methods1
staticcocos2d::CCLayer*create()

create one layer

Public member functions43
virtualboolinit()
No description provided
virtualvoidonEnter()
No description provided
virtualvoidonExit()
No description provided
virtualvoidonEnterTransitionDidFinish()
No description provided
virtualboolccTouchBegan(,)
No description provided
virtualvoidccTouchMoved(,)
No description provided
virtualvoidccTouchEnded(,)
No description provided
virtualvoidccTouchCancelled(,)
No description provided
virtualvoidccTouchesBegan(,)
No description provided
virtualvoidccTouchesMoved(,)
No description provided
virtualvoidccTouchesEnded(,)
No description provided
virtualvoidccTouchesCancelled(,)
No description provided
virtualvoiddidAccelerate(
cocos2d::CCAcceleration*pAccelerationValue
)
No description provided
voidregisterScriptAccelerateHandler(
intnHandler
)
No description provided
voidunregisterScriptAccelerateHandler()
No description provided
virtualvoidregisterWithTouchDispatcher()

Since v0.8.0

If isTouchEnabled, this method is called onEnter. Override it to change the way CCLayer receives touch events. ( Default: CCTouchDispatcher::sharedDispatcher()->addStandardDelegate(this,0); ) Example: void CCLayer::registerWithTouchDispatcher() { CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN+1,true); }

virtualvoidregisterScriptTouchHandler(
intnHandler
,
boolbIsMultiTouches
,
intnPriority
,
boolbSwallowsTouches
)

Register script touch events handler

virtualvoidunregisterScriptTouchHandler()

Unregister script touch events handler

virtualboolisTouchEnabled()

Since v0.8.1

whether or not it will receive Touch events. You can enable / disable touch events with this property. Only the touches of this node will be affected. This “method” is not propagated to it’s children.

virtualvoidsetTouchEnabled(
boolvalue
)
No description provided
virtualvoidsetTouchMode()
No description provided
virtualintgetTouchMode()
No description provided
virtualvoidsetTouchPriority(
intpriority
)

priority of the touch events. Default is 0

virtualintgetTouchPriority()
No description provided
virtualboolisAccelerometerEnabled()

Since v0.8.1

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

virtualvoidsetAccelerometerEnabled(
boolvalue
)
No description provided
virtualvoidsetAccelerometerInterval(
doubleinterval
)
No description provided
virtualboolisKeypadEnabled()

whether or not it will receive keypad events You can enable / disable accelerometer events with this property. it’s new in cocos2d-x

virtualvoidsetKeypadEnabled(
boolvalue
)
No description provided
virtualboolisKeyboardEnabled()
No description provided
virtualvoidsetKeyboardEnabled(
boolvalue
)
No description provided
virtualboolisMouseEnabled()
No description provided
virtualvoidsetMouseEnabled(
boolvalue
)
No description provided
voidregisterScriptKeypadHandler(
intnHandler
)

Register keypad events handler

voidunregisterScriptKeypadHandler()

Unregister keypad events handler

virtualvoidkeyBackClicked()
No description provided
virtualvoidkeyMenuClicked()
No description provided
virtualvoidkeyDown()
No description provided
virtualvoidsetPreviousPriority()
No description provided
virtualintgetPreviousPriority()
No description provided
cocos2d::CCTouchScriptHandlerEntry*getScriptTouchHandlerEntry()
No description provided
cocos2d::CCScriptHandlerEntry*getScriptKeypadHandlerEntry()
No description provided
cocos2d::CCScriptHandlerEntry*getScriptAccelerateHandlerEntry()
No description provided
Fields0
Protected member functions0
Protected fields5
boolm_bTouchEnabled
;
No description provided
boolm_bAccelerometerEnabled
;
No description provided
boolm_bKeypadEnabled
;
No description provided
boolm_bKeyboardEnabled
;
No description provided
boolm_bMouseEnabled
;
No description provided