CCNode
CCNode
Cocos2DInheritance: System.Object
Implements: Cocos2D.ICCSelectorProtocol, Cocos2D.ICCFocusable, Cocos2D.ICCTargetedTouchDelegate, Cocos2D.ICCStandardTouchDelegate, Cocos2D.ICCTouchDelegate, Cocos2D.ICCKeypadDelegate, Cocos2D.ICCKeyboardDelegate, Cocos2D.ICCRGBAProtocol, System.Collections.Generic.IComparer{Cocos2D.CCNode}
Constructors
CCNode()
CCNode()()
CCNode(CCSize)
CCNode(CCSize)(Cocos2D.CCSize contentSize)
Parameters:
contentSize
(Cocos2D.CCSize)Fields
Use this to determine if a tag has been set on the node.
Properties
returns the Anchor Point of the node as a value [0,1], where 1 is 100% of the dimension and 0 is 0%.
Returns the anchor point in pixels, AnchorPoint * ContentSize. This does not use the scale factor of the node.
Returns the bounding box of this node in the coordinate system of its parent.
Returns the bounding box of this node, in the coordinate system of its parent, with the scale, content scale, and other display transforms applied to return the per-pixel bounding box.
Returns the camera for this node.
returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity); @since v0.8 whether or not color should be propagated to its children.
whether or not opacity should be propagated to its children.
Gets or sets the color
Returns the content size with the scale applied.
This is only valid when the node is used in a CCGrid action. Expect this to be null when no grid action is active.
sets the premultipliedAlphaOpacity property. If set to NO then opacity will be applied as: glColor(R,G,B,opacity); If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity ); Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO @since v0.8
Gets whether or not this scene is serializable. If this is true, the screen will be recorded into the director's state and its Serialize and Deserialize methods will be called as appropriate. If this is false, the screen will be ignored during serialization. By default, all screens are assumed to be serializable.
Gets or sets the Opacity @warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed. Values goes from 0 to 255, where 255 means fully opaque.
Sets and gets the position of the node. For Menus, this is the center of the menu. For layers, this is the lower left corner of the layer.
Safely set the X position of the node. This will not create unnecessary temporary instances of the Position's CCPoint instance.
Safely set the Y position of the node. This will not create unnecessary temporary instances of the Position's CCPoint instance.
2D rotation of the node relative to the 0,1 vector in a clock-wise orientation.
The general scale that applies to both X and Y directions.
Scale of the node in the X direction (left to right)
Scale of the node in the Y direction (top to bottom)
Get or set the priority at which touches are sent to this node. When CCConfiguration.UseGraphPriority is true, set values that are on the range [0,9]. This method returns a priority value that uses graph priority where each graph level is a factor of 10.
This returns true if the node is visible and the parent is visible. Otherwise, it returns false.
A visibility parameter that determines if touches are delivered to a delegate.
Returns whether or not the node is visible IN the parent node. This simply returns the value of m_bVisible.
Returns the bounding box of this node in world coordinates
Methods
AddChild(CCNode)
AddChild(CCNode)(Cocos2D.CCNode child)
Parameters:
child
(Cocos2D.CCNode)AddChild(CCNode, int)
AddChild(CCNode, int)(Cocos2D.CCNode child, System.Int32 zOrder)
Parameters:
child
(Cocos2D.CCNode)zOrder
(System.Int32)AddChild(CCNode, int, int)
AddChild(CCNode, int, int)(Cocos2D.CCNode child, System.Int32 zOrder, System.Int32 tag)
Parameters:
child
(Cocos2D.CCNode)zOrder
(System.Int32)tag
(System.Int32)AddedToScene()
AddedToScene()()
CleanUpParentsProperly()
CleanUpParentsProperly()()
Cleanup()
Cleanup()()
Compare(CCNode, CCNode)
System.Int32 Compare(CCNode, CCNode)(Cocos2D.CCNode n1, Cocos2D.CCNode n2)
Parameters:
n1
(Cocos2D.CCNode)n2
(Cocos2D.CCNode)Returns:
System.Int32
Example
ConvertPointTo(ref CCPoint, CCNode)
Cocos2D.CCPoint ConvertPointTo(ref CCPoint, CCNode)(Cocos2D.CCPoint ptInNode, Cocos2D.CCNode target)
Returns the given point, which is assumed to be in this node's coordinate system, as a point in the given target's coordinate system.
Parameters:
ptInNode
(Cocos2D.CCPoint)target
(Cocos2D.CCNode)Returns:
Cocos2D.CCPoint
Example
ConvertToNodeSpace(CCPoint)
Cocos2D.CCPoint ConvertToNodeSpace(CCPoint)(Cocos2D.CCPoint worldPoint)
Parameters:
worldPoint
(Cocos2D.CCPoint)Returns:
Cocos2D.CCPoint
ConvertToNodeSpaceAr(CCPoint)
Cocos2D.CCPoint ConvertToNodeSpaceAr(CCPoint)(Cocos2D.CCPoint worldPoint)
Parameters:
worldPoint
(Cocos2D.CCPoint)Returns:
Cocos2D.CCPoint
ConvertToWindowSpace(CCPoint)
Cocos2D.CCPoint ConvertToWindowSpace(CCPoint)(Cocos2D.CCPoint nodePoint)
Parameters:
nodePoint
(Cocos2D.CCPoint)Returns:
Cocos2D.CCPoint
ConvertToWorldSpace(CCPoint)
Cocos2D.CCPoint ConvertToWorldSpace(CCPoint)(Cocos2D.CCPoint nodePoint)
Parameters:
nodePoint
(Cocos2D.CCPoint)Returns:
Cocos2D.CCPoint
ConvertToWorldSpaceAr(CCPoint)
Cocos2D.CCPoint ConvertToWorldSpaceAr(CCPoint)(Cocos2D.CCPoint nodePoint)
Parameters:
nodePoint
(Cocos2D.CCPoint)Returns:
Cocos2D.CCPoint
ConvertTouchToNodeSpace(CCTouch)
Cocos2D.CCPoint ConvertTouchToNodeSpace(CCTouch)(Cocos2D.CCTouch touch)
Parameters:
touch
(Cocos2D.CCTouch)Returns:
Cocos2D.CCPoint
ConvertTouchToNodeSpaceAr(CCTouch)
Cocos2D.CCPoint ConvertTouchToNodeSpaceAr(CCTouch)(Cocos2D.CCTouch touch)
Parameters:
touch
(Cocos2D.CCTouch)Returns:
Cocos2D.CCPoint
Deserialize(Stream)
Deserialize(Stream)(System.IO.Stream stream)
Tells the screen to deserialize its state from the given stream.
Parameters:
stream
(System.IO.Stream)Example
Dispose()
Dispose()()
Dispose(bool)
Dispose(bool)(System.Boolean disposing)
Parameters:
disposing
(System.Boolean)Draw()
Draw()()
This is called from the Visit() method. This is where you DRAW your node. Only draw stuff from this method call.
Example
~CCNode()
~CCNode()()
ForceTransformRefresh()
ForceTransformRefresh()()
Sets all of the transform indictators to dirty so that the visual transforms are recomputed.
Example
GetAction(int)
Cocos2D.CCAction GetAction(int)(System.Int32 tag)
Parameters:
tag
(System.Int32)Returns:
Cocos2D.CCAction
GetBoundingBox(CCNode)
Cocos2D.CCRect GetBoundingBox(CCNode)(Cocos2D.CCNode target)
Returns this node's bounding box in the coordinate system of the given target.
Parameters:
target
(Cocos2D.CCNode)Returns:
Cocos2D.CCRect
Example
GetChildByTag(int)
Cocos2D.CCNode GetChildByTag(int)(System.Int32 tag)
Parameters:
tag
(System.Int32)Returns:
Cocos2D.CCNode
GetPosition(out float, out float)
GetPosition(out float, out float)(System.Single x, System.Single y)
Parameters:
x
(System.Single)y
(System.Single)Init()
System.Boolean Init()()
Returns:
System.Boolean
KeyBackClicked()
KeyBackClicked()()
Example
KeyMenuClicked()
KeyMenuClicked()()
Example
KeyPressed(Keys)
KeyPressed(Keys)(Microsoft.Xna.Framework.Input.Keys key)
Parameters:
key
(Microsoft.Xna.Framework.Input.Keys)Example
KeyReleased(Keys)
KeyReleased(Keys)(Microsoft.Xna.Framework.Input.Keys key)
Parameters:
key
(Microsoft.Xna.Framework.Input.Keys)Example
KeyboardCurrentState(KeyboardState)
KeyboardCurrentState(KeyboardState)(Microsoft.Xna.Framework.Input.KeyboardState currentState)
Parameters:
currentState
(Microsoft.Xna.Framework.Input.KeyboardState)Example
NodeToParentTransform()
Cocos2D.CCAffineTransform NodeToParentTransform()()
Returns:
Cocos2D.CCAffineTransform
NodeToWorldTransform()
Cocos2D.CCAffineTransform NodeToWorldTransform()()
Returns:
Cocos2D.CCAffineTransform
NumberOfRunningActions()
System.Int32 NumberOfRunningActions()()
Returns:
System.Int32
OnEnter()
OnEnter()()
OnEnterTransitionDidFinish()
OnEnterTransitionDidFinish()()
OnExit()
OnExit()()
OnExitTransitionDidStart()
OnExitTransitionDidStart()()
OnGamePadButtonUpdate(CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, PlayerIndex)
OnGamePadButtonUpdate(CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, PlayerIndex)(Cocos2D.CCGamePadButtonStatus backButton, Cocos2D.CCGamePadButtonStatus startButton, Cocos2D.CCGamePadButtonStatus systemButton, Cocos2D.CCGamePadButtonStatus aButton, Cocos2D.CCGamePadButtonStatus bButton, Cocos2D.CCGamePadButtonStatus xButton, Cocos2D.CCGamePadButtonStatus yButton, Cocos2D.CCGamePadButtonStatus leftShoulder, Cocos2D.CCGamePadButtonStatus rightShoulder, Microsoft.Xna.Framework.PlayerIndex player)
Parameters:
backButton
(Cocos2D.CCGamePadButtonStatus)startButton
(Cocos2D.CCGamePadButtonStatus)systemButton
(Cocos2D.CCGamePadButtonStatus)aButton
(Cocos2D.CCGamePadButtonStatus)bButton
(Cocos2D.CCGamePadButtonStatus)xButton
(Cocos2D.CCGamePadButtonStatus)yButton
(Cocos2D.CCGamePadButtonStatus)leftShoulder
(Cocos2D.CCGamePadButtonStatus)rightShoulder
(Cocos2D.CCGamePadButtonStatus)player
(Microsoft.Xna.Framework.PlayerIndex)OnGamePadConnectionUpdate(PlayerIndex, bool)
OnGamePadConnectionUpdate(PlayerIndex, bool)(Microsoft.Xna.Framework.PlayerIndex player, System.Boolean IsConnected)
Parameters:
player
(Microsoft.Xna.Framework.PlayerIndex)IsConnected
(System.Boolean)OnGamePadDPadUpdate(CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, PlayerIndex)
OnGamePadDPadUpdate(CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, CCGamePadButtonStatus, PlayerIndex)(Cocos2D.CCGamePadButtonStatus leftButton, Cocos2D.CCGamePadButtonStatus upButton, Cocos2D.CCGamePadButtonStatus rightButton, Cocos2D.CCGamePadButtonStatus downButton, Microsoft.Xna.Framework.PlayerIndex player)
Parameters:
leftButton
(Cocos2D.CCGamePadButtonStatus)upButton
(Cocos2D.CCGamePadButtonStatus)rightButton
(Cocos2D.CCGamePadButtonStatus)downButton
(Cocos2D.CCGamePadButtonStatus)player
(Microsoft.Xna.Framework.PlayerIndex)OnGamePadStickUpdate(CCGameStickStatus, CCGameStickStatus, PlayerIndex)
OnGamePadStickUpdate(CCGameStickStatus, CCGameStickStatus, PlayerIndex)(Cocos2D.CCGameStickStatus leftStick, Cocos2D.CCGameStickStatus rightStick, Microsoft.Xna.Framework.PlayerIndex player)
Parameters:
leftStick
(Cocos2D.CCGameStickStatus)rightStick
(Cocos2D.CCGameStickStatus)player
(Microsoft.Xna.Framework.PlayerIndex)OnGamePadTriggerUpdate(float, float, PlayerIndex)
OnGamePadTriggerUpdate(float, float, PlayerIndex)(System.Single leftTriggerStrength, System.Single rightTriggerStrength, Microsoft.Xna.Framework.PlayerIndex player)
Parameters:
leftTriggerStrength
(System.Single)rightTriggerStrength
(System.Single)player
(Microsoft.Xna.Framework.PlayerIndex)ParentToNodeTransform()
Cocos2D.CCAffineTransform ParentToNodeTransform()()
Returns:
Cocos2D.CCAffineTransform
Pause()
Pause()()
This will pause scheduler, actions and unregister dispatcher
Example
PauseSchedulerAndActions()
PauseSchedulerAndActions()()
RegisterWithTouchDispatcher()
RegisterWithTouchDispatcher()()
RemoveAllChildren(bool)
RemoveAllChildren(bool)(System.Boolean cleanup)
Parameters:
cleanup
(System.Boolean)RemoveAllChildrenByTag(int)
RemoveAllChildrenByTag(int)(System.Int32 tag)
Parameters:
tag
(System.Int32)RemoveAllChildrenByTag(int, bool)
RemoveAllChildrenByTag(int, bool)(System.Int32 tag, System.Boolean cleanup)
Parameters:
tag
(System.Int32)cleanup
(System.Boolean)RemoveChild(CCNode, bool)
RemoveChild(CCNode, bool)(Cocos2D.CCNode child, System.Boolean cleanup)
Parameters:
child
(Cocos2D.CCNode)cleanup
(System.Boolean)RemoveChildByTag(int)
RemoveChildByTag(int)(System.Int32 tag)
Parameters:
tag
(System.Int32)RemoveChildByTag(int, bool)
RemoveChildByTag(int, bool)(System.Int32 tag, System.Boolean cleanup)
Parameters:
tag
(System.Int32)cleanup
(System.Boolean)RemoveFromParent(bool)
RemoveFromParent(bool)(System.Boolean cleanup)
Parameters:
cleanup
(System.Boolean)ReorderChild(CCNode, int)
ReorderChild(CCNode, int)(Cocos2D.CCNode child, System.Int32 zOrder)
Parameters:
child
(Cocos2D.CCNode)zOrder
(System.Int32)ResetCleanState()
ResetCleanState()()
Resume()
Resume()()
This will resume scheduler, actions and register dispatcher
Example
ResumeSchedulerAndActions()
ResumeSchedulerAndActions()()
RunAction(CCAction)
Cocos2D.CCAction RunAction(CCAction)(Cocos2D.CCAction action)
Parameters:
action
(Cocos2D.CCAction)Returns:
Cocos2D.CCAction
Schedule(Action)
Schedule(Action)(System.ActionSystem.Single selector)
Parameters:
selector
(System.ActionSystem.Single)Schedule(Action, float)
Schedule(Action, float)(System.ActionSystem.Single selector, System.Single interval)
Parameters:
selector
(System.ActionSystem.Single)interval
(System.Single)Schedule(Action, float, uint, float)
Schedule(Action, float, uint, float)(System.ActionSystem.Single selector, System.Single interval, System.UInt32 repeat, System.Single delay)
Parameters:
selector
(System.ActionSystem.Single)interval
(System.Single)repeat
(System.UInt32)delay
(System.Single)ScheduleOnce(Action, float)
ScheduleOnce(Action, float)(System.ActionSystem.Single selector, System.Single delay)
Parameters:
selector
(System.ActionSystem.Single)delay
(System.Single)ScheduleUpdate()
ScheduleUpdate()()
ScheduleUpdateWithPriority(int)
ScheduleUpdateWithPriority(int)(System.Int32 priority)
Parameters:
priority
(System.Int32)Serialize(Stream)
Serialize(Stream)(System.IO.Stream stream)
Tells the screen to serialize its state into the given stream.
Parameters:
stream
(System.IO.Stream)Example
SetPosition(float, float)
SetPosition(float, float)(System.Single x, System.Single y)
Parameters:
x
(System.Single)y
(System.Single)SetTransform(CCAffineTransform)
SetTransform(CCAffineTransform)(Cocos2D.CCAffineTransform tx)
Parameters:
tx
(Cocos2D.CCAffineTransform)SetTransformIsDirty()
SetTransformIsDirty()()
Set my transform to be dirty and recursively set my children's transform to be dirty.
Example
SetWorldTransformIsDirty()
SetWorldTransformIsDirty()()
SortAllChildren()
SortAllChildren()()
StopAction(CCAction)
StopAction(CCAction)(Cocos2D.CCAction action)
Parameters:
action
(Cocos2D.CCAction)StopAction(int)
StopAction(int)(System.Int32 tag)
Parameters:
tag
(System.Int32)StopAllActions()
StopAllActions()()
TouchBegan(CCTouch)
System.Boolean TouchBegan(CCTouch)(Cocos2D.CCTouch touch)
Returns true signaling that this node will consume the touch.
Parameters:
touch
(Cocos2D.CCTouch)Returns:
System.Boolean
Example
TouchCancelled(CCTouch)
TouchCancelled(CCTouch)(Cocos2D.CCTouch touch)
Parameters:
touch
(Cocos2D.CCTouch)Example
TouchEnded(CCTouch)
TouchEnded(CCTouch)(Cocos2D.CCTouch touch)
Parameters:
touch
(Cocos2D.CCTouch)Example
TouchMoved(CCTouch)
TouchMoved(CCTouch)(Cocos2D.CCTouch touch)
Parameters:
touch
(Cocos2D.CCTouch)Example
TouchesBegan(List)
TouchesBegan(List)(System.Collections.Generic.ListCocos2D.CCTouch touches)
Parameters:
touches
(System.Collections.Generic.ListCocos2D.CCTouch)Example
TouchesCancelled(List)
TouchesCancelled(List)(System.Collections.Generic.ListCocos2D.CCTouch touches)
Parameters:
touches
(System.Collections.Generic.ListCocos2D.CCTouch)Example
TouchesEnded(List)
TouchesEnded(List)(System.Collections.Generic.ListCocos2D.CCTouch touches)
Parameters:
touches
(System.Collections.Generic.ListCocos2D.CCTouch)Example
TouchesMoved(List)
TouchesMoved(List)(System.Collections.Generic.ListCocos2D.CCTouch touches)
Parameters:
touches
(System.Collections.Generic.ListCocos2D.CCTouch)Example
Transform()
Transform()()
TransformAncestors()
TransformAncestors()()
Unschedule(Action)
Unschedule(Action)(System.ActionSystem.Single selector)
Parameters:
selector
(System.ActionSystem.Single)UnscheduleAll()
UnscheduleAll()()
UnscheduleAllSelectors()
UnscheduleAllSelectors()()
UnscheduleUpdate()
UnscheduleUpdate()()
Update(float)
Update(float)(System.Single dt)
Parameters:
dt
(System.Single)Example
UpdateDisplayedColor(CCColor3B)
UpdateDisplayedColor(CCColor3B)(Cocos2D.CCColor3B parentColor)
recursive method that updates display color
Parameters:
parentColor
(Cocos2D.CCColor3B)Example
UpdateDisplayedOpacity(byte)
UpdateDisplayedOpacity(byte)(System.Byte parentOpacity)
recursive method that updates the displayed opacity.
Parameters:
parentOpacity
(System.Byte)Example
UpdateGraphIndex()
UpdateGraphIndex()()
UpdateTransform()
UpdateTransform()()
UpdateZOrderRange()
UpdateZOrderRange()()
Visit()
Visit()()
This is called with every call to the MainLoop on the CCDirector class. In XNA, this is the same as the Draw() call.
Example
Visit(ref CCAffineTransform)
Visit(ref CCAffineTransform)(Cocos2D.CCAffineTransform parentWorldTransform)
Parameters:
parentWorldTransform
(Cocos2D.CCAffineTransform)VisitRenderer(ref CCAffineTransform)
VisitRenderer(ref CCAffineTransform)(Cocos2D.CCAffineTransform worldTransform)
Parameters:
worldTransform
(Cocos2D.CCAffineTransform)WorldToNodeTransform()
Cocos2D.CCAffineTransform WorldToNodeTransform()()
Returns:
Cocos2D.CCAffineTransform