Class Index | File Index

Classes


Class cc.Layer


Extends cc.Node.

Defined in: CCLayer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.Layer is a subclass of cc.Node that implements the TouchEventsDelegate protocol.
Method Summary
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.
 
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
 
 
onMouseDown(event)

called when the "mouseDown" event is received.

 

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.

 

called when the "otherMouseDown" event is received.

 

called when the "otherMouseDragged" event is received.

 

called when the "otherMouseUp" event is received.

 

called when the "rightMouseDown" event is received.

 

called when the "rightMouseDragged" event is received.

 

called when the "rightMouseUp" event is received.

 

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.
 
isAccelerometerEnabled setter
 
Enable Keyboard interaction
 
setMouseEnabled(enabled)
 
setMousePriority(priority)
 
setTouchEnabled(enabled)
Enable touch events
 
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
Class Detail
cc.Layer()
cc.Layer is a subclass of cc.Node that implements the TouchEventsDelegate protocol.
All features from cc.Node are valid, plus the following new features:
It can receive iPhone Touches
It can receive Accelerometer input
Method Detail
<static> {cc.Layer|Null} cc.Layer.create()
creates a layer
// Example
var myLayer = cc.Layer.create();
//Yes! it's that simple
Returns:
{cc.Layer|Null}

ctor()
Constructor

didAccelerate(pAccelerationValue)
Parameters:
pAccelerationValue

getMousePriority()

{Number} getTouchMode()
returns the touch mode.
Returns:
{Number}

{Number} getTouchPriority()
returns the priority of the touch event handler
Returns:
{Number}

{Boolean} init()
Returns:
{Boolean}

{Boolean} isAccelerometerEnabled()
whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property.
Returns:
{Boolean}

{Boolean} isKeyboardEnabled()
whether or not it will receive keyboard events
You can enable / disable accelerometer events with this property.
it's new in cocos2d-x
Returns:
{Boolean}

isMouseEnabled()

{Boolean} isTouchEnabled()
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.
Returns:
{Boolean}

onEnter()
This is run when ever a layer just become visible

onEnterTransitionDidFinish()
this is called when ever a layer is a child of a scene that just finished a transition

onExit()

{Boolean} onMouseDown(event)

called when the "mouseDown" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onMouseDragged(event)

called when the "mouseDragged" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onMouseEntered(theEvent)

called when the "mouseEntered" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
theEvent
Returns:
{Boolean}

{Boolean} onMouseExited(theEvent)

called when the "mouseExited" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
theEvent
Returns:
{Boolean}

{Boolean} onMouseMoved(event)

called when the "mouseMoved" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onMouseUp(event)

called when the "mouseUp" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onOtherMouseDown(event)

called when the "otherMouseDown" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onOtherMouseDragged(event)

called when the "otherMouseDragged" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onOtherMouseUp(event)

called when the "otherMouseUp" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onRightMouseDown(event)

called when the "rightMouseDown" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onRightMouseDragged(event)

called when the "rightMouseDragged" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onRightMouseUp(event)

called when the "rightMouseUp" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} onScrollWheel(event)

called when the "scrollWheel" event is received.
Return YES to avoid propagating the event to other delegates.

Parameters:
event
Returns:
{Boolean}

{Boolean} 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
Parameters:
{cc.Touch} touch
{event} event
Returns:
{Boolean}

onTouchCancelled(touch, event)
Parameters:
{cc.Touch} touch
{event} event

onTouchEnded(touch, event)
callback when a touch event finished
Parameters:
{cc.Touch} touch
{event} event

onTouchesBegan(touch, event)
Touches is the same as Touch, except this one can handle multi-touch
Parameters:
{cc.Touch} touch
{event} event

onTouchesCancelled(touch, event)
Parameters:
touch
event

onTouchesEnded(touch, event)
when a touch finished
Parameters:
{cc.Touch} touch
{event} event

onTouchesMoved(touch, event)
when a touch moved
Parameters:
{cc.Touch} touch
{event} event

onTouchMoved(touch, event)
callback when a touch event moved
Parameters:
{cc.Touch} touch
{event} event

registerWithTouchDispatcher()
If isTouchEnabled, this method is called onEnter.

setAccelerometerEnabled(enabled)
isAccelerometerEnabled setter
Parameters:
enabled

setKeyboardEnabled(enabled)
Enable Keyboard interaction
Parameters:
{Boolean} enabled

setMouseEnabled(enabled)
Parameters:
enabled

setMousePriority(priority)
Parameters:
priority

setTouchEnabled(enabled)
Enable touch events
Parameters:
{Boolean} enabled

setTouchMode(mode)
Sets the touch mode.
Parameters:
{Number} mode

setTouchPriority(priority)
Sets the touch event handler priority. Default is 0.
Parameters:
{Number} priority

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:51 GMT-0800 (PST)