Class cc.Layer
Extends
cc.Node.
Defined in: CCLayer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
cc.Layer()
cc.Layer is a subclass of cc.Node that implements the TouchEventsDelegate protocol.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
cc.Layer.create()
creates a layer
|
ctor()
Constructor
|
|
didAccelerate(pAccelerationValue)
|
|
returns the touch mode.
|
|
returns the priority of the touch event handler
|
|
init()
|
|
whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property. |
|
whether or not it will receive keyboard events
You can enable / disable accelerometer events with this property. |
|
whether or not it will receive Touch events.
|
|
onEnter()
This is run when ever a layer just become visible
|
|
this is called when ever a layer is a child of a scene that just finished a transition
|
|
onExit()
|
|
onMouseDown(event)
called when the "mouseDown" event is received. |
|
onMouseDragged(event)
called when the "mouseDragged" event is received. |
|
onMouseEntered(theEvent)
called when the "mouseEntered" event is received. |
|
onMouseExited(theEvent)
called when the "mouseExited" event is received. |
|
onMouseMoved(event)
called when the "mouseMoved" event is received. |
|
onMouseUp(event)
called when the "mouseUp" event is received. |
|
onOtherMouseDown(event)
called when the "otherMouseDown" event is received. |
|
onOtherMouseDragged(event)
called when the "otherMouseDragged" event is received. |
|
onOtherMouseUp(event)
called when the "otherMouseUp" event is received. |
|
onRightMouseDown(event)
called when the "rightMouseDown" event is received. |
|
onRightMouseDragged(event)
called when the "rightMouseDragged" event is received. |
|
onRightMouseUp(event)
called when the "rightMouseUp" event is received. |
|
onScrollWheel(event)
called when the "scrollWheel" event is received. |
|
onTouchBegan(touch, event)
default implements are used to call script callback if exist
you must override these touch functions if you wish to utilize them |
|
onTouchCancelled(touch, event)
|
|
onTouchEnded(touch, event)
callback when a touch event finished
|
|
onTouchesBegan(touch, event)
Touches is the same as Touch, except this one can handle multi-touch
|
|
onTouchesCancelled(touch, event)
|
|
onTouchesEnded(touch, event)
when a touch finished
|
|
onTouchesMoved(touch, event)
when a touch moved
|
|
onTouchMoved(touch, event)
callback when a touch event moved
|
|
If isTouchEnabled, this method is called onEnter.
|
|
setAccelerometerEnabled(enabled)
isAccelerometerEnabled setter
|
|
setKeyboardEnabled(enabled)
Enable Keyboard interaction
|
|
setMouseEnabled(enabled)
|
|
setMousePriority(priority)
|
|
setTouchEnabled(enabled)
Enable touch events
|
|
setTouchMode(mode)
Sets the touch mode.
|
|
setTouchPriority(priority)
Sets the touch event handler priority.
|
- Methods borrowed from class cc.Node:
- addChild, cleanup, convertToNodeSpace, convertToNodeSpaceAR, convertTouchToNodeSpace, convertTouchToNodeSpaceAR, convertToWorldSpace, convertToWorldSpaceAR, description, draw, getActionByTag, getActionManager, getAnchorPoint, getAnchorPointInPoints, getBoundingBox, getBoundingBoxToWorld, getCamera, getChildByTag, getChildren, getChildrenCount, getContentSize, getGLServerState, getGrid, getOrderOfArrival, getParent, getPosition, getPositionX, getPositionY, getRotation, getScale, getScaleX, getScaleY, getScheduler, getShaderProgram, getSkewX, getSkewY, getTag, getUserData, getUserObject, getVertexZ, getZOrder, ignoreAnchorPointForPosition, isIgnoreAnchorPointForPosition, isRunning, isVisible, nodeToParentTransform, nodeToWorldTransform, numberOfRunningActions, onExitTransitionDidStart, parentToNodeTransform, pauseSchedulerAndActions, release, removeAllChildren, removeAllChildrenWithCleanup, removeChild, removeChildByTag, removeFromParent, removeFromParentAndCleanup, reorderChild, resumeSchedulerAndActions, retain, runAction, schedule, scheduleOnce, scheduleUpdate, scheduleUpdateWithPriority, setActionManager, setAnchorPoint, setContentSize, setGLServerState, setGrid, setNodeDirty, setOrderOfArrival, setParent, setPosition, setPositionX, setPositionY, setRotation, setScale, setScaleX, setScaleY, setScheduler, setShaderProgram, setSkewX, setSkewY, setTag, setUserData, setUserObject, setVertexZ, setVisible, setZOrder, sortAllChildren, stopAction, stopActionByTag, stopAllActions, transform, transformAncestors, unschedule, unscheduleAllCallbacks, unscheduleUpdate, update, updateTransform, visit, worldToNodeTransform
All features from cc.Node are valid, plus the following new features:
It can receive iPhone Touches
It can receive Accelerometer input
// Example var myLayer = cc.Layer.create(); //Yes! it's that simple
- Returns:
- {cc.Layer|Null}
- Parameters:
- pAccelerationValue
- Returns:
- {Number}
- Returns:
- {Number}
- Returns:
- {Boolean}
You can enable / disable accelerometer events with this property.
- Returns:
- {Boolean}
You can enable / disable accelerometer events with this property.
it's new in cocos2d-x
- Returns:
- {Boolean}
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.
- Returns:
- {Boolean}
called when the "mouseDown" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "mouseDragged" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "mouseEntered" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- theEvent
- Returns:
- {Boolean}
called when the "mouseExited" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- theEvent
- Returns:
- {Boolean}
called when the "mouseMoved" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "mouseUp" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "otherMouseDown" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "otherMouseDragged" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "otherMouseUp" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "rightMouseDown" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "rightMouseDragged" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "rightMouseUp" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
called when the "scrollWheel" event is received.
Return YES to avoid propagating the event to other delegates.
- Parameters:
- event
- Returns:
- {Boolean}
you must override these touch functions if you wish to utilize them
- Parameters:
- {cc.Touch} touch
- {event} event
- Returns:
- {Boolean}
- Parameters:
- {cc.Touch} touch
- {event} event
- Parameters:
- {cc.Touch} touch
- {event} event
- Parameters:
- {cc.Touch} touch
- {event} event
- Parameters:
- touch
- event
- Parameters:
- {cc.Touch} touch
- {event} event
- Parameters:
- {cc.Touch} touch
- {event} event
- Parameters:
- {cc.Touch} touch
- {event} event
- Parameters:
- enabled
- Parameters:
- {Boolean} enabled
- Parameters:
- enabled
- Parameters:
- priority
- Parameters:
- {Boolean} enabled
- Parameters:
- {Number} mode
- Parameters:
- {Number} priority