Struct rcocos2d_sys::cocos2d_CCNode [−][src]
#[repr(C)]pub struct cocos2d_CCNode {}Show 38 fields
pub _base: cocos2d_CCObject, pub m_fRotationX: f32, pub m_fRotationY: f32, pub m_fScaleX: f32, pub m_fScaleY: f32, pub m_fVertexZ: f32, pub m_obPosition: cocos2d_CCPoint, pub m_fSkewX: f32, pub m_fSkewY: f32, pub m_obAnchorPointInPoints: cocos2d_CCPoint, pub m_obAnchorPoint: cocos2d_CCPoint, pub m_obContentSize: cocos2d_CCSize, pub m_sAdditionalTransform: cocos2d_CCAffineTransform, pub m_sTransform: cocos2d_CCAffineTransform, pub m_sInverse: cocos2d_CCAffineTransform, pub m_pCamera: *mut cocos2d_CCCamera, pub m_pGrid: *mut cocos2d_CCGridBase, pub m_nZOrder: c_int, pub m_pChildren: *mut cocos2d_CCArray, pub m_pParent: *mut cocos2d_CCNode, pub m_pUserData: *mut c_void, pub m_pUserObject: *mut cocos2d_CCObject, pub m_pShaderProgram: *mut cocos2d_CCGLProgram, pub m_eGLServerState: cocos2d_ccGLServerState, pub m_uOrderOfArrival: c_uint, pub m_pScheduler: *mut cocos2d_CCScheduler, pub m_pActionManager: *mut cocos2d_CCActionManager, pub m_bRunning: bool, pub m_bTransformDirty: bool, pub m_bInverseDirty: bool, pub m_bAdditionalTransformDirty: bool, pub m_bVisible: bool, pub m_bIgnoreAnchorPointForPosition: bool, pub m_bReorderChildDirty: bool, pub m_nScriptHandler: c_int, pub m_nUpdateScriptHandler: c_int, pub m_eScriptType: cocos2d_ccScriptType, pub m_pComponentContainer: *mut cocos2d_CCComponentContainer,
Expand description
@brief CCNode is the main element. Anything that gets drawn or contains things that get drawn is a CCNode. The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.
The main features of a CCNode are:
- They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc)
- They can schedule periodic callback (schedule, unschedule, etc)
- They can execute actions (runAction, stopAction, etc)
Some CCNode nodes provide extra functionality for them or their children.
Subclassing a CCNode usually means (one/all) of:
- overriding init to initialize resources and schedule callbacks
- create callbacks to handle the advancement of time
- overriding draw to render the node
Features of CCNode:
- position
- scale (x, y)
- rotation (in degrees, clockwise)
- CCCamera (an interface to gluLookAt )
- CCGridBase (to do mesh transformations)
- anchor point
- size
- visible
- z-order
- openGL z position
Default values:
- rotation: 0
- position: (x=0,y=0)
- scale: (x=1,y=1)
- contentSize: (x=0,y=0)
- anchorPoint: (x=0,y=0)
Limitations:
- A CCNode is a “void” object. It doesn’t have a texture
Order in transformations with grid disabled -# The node will be translated (position) -# The node will be rotated (rotation) -# The node will be scaled (scale) -# The node will be moved according to the camera values (camera)
Order in transformations with grid enabled -# The node will be translated (position) -# The node will be rotated (rotation) -# The node will be scaled (scale) -# The grid will capture the screen -# The node will be moved according to the camera values (camera) -# The grid will render the captured screen
Camera:
- Each node has a camera. By default it points to the center of the CCNode.
Fields
_base: cocos2d_CCObject
m_fRotationX: f32
< rotation angle on x-axis
m_fRotationY: f32
< rotation angle on y-axis
m_fScaleX: f32
< scaling factor on x-axis
m_fScaleY: f32
< scaling factor on y-axis
m_fVertexZ: f32
< OpenGL real Z vertex
m_obPosition: cocos2d_CCPoint
< position of the node
m_fSkewX: f32
< skew angle on x-axis
m_fSkewY: f32
< skew angle on y-axis
m_obAnchorPointInPoints: cocos2d_CCPoint
< anchor point in points
m_obAnchorPoint: cocos2d_CCPoint
< anchor point normalized (NOT in points)
m_obContentSize: cocos2d_CCSize
< untransformed size of the node
m_sAdditionalTransform: cocos2d_CCAffineTransform
< transform
m_sTransform: cocos2d_CCAffineTransform
< transform
m_sInverse: cocos2d_CCAffineTransform
< transform
m_pCamera: *mut cocos2d_CCCamera
< a camera
m_pGrid: *mut cocos2d_CCGridBase
< a grid
m_nZOrder: c_int
< z-order value that affects the draw order
m_pChildren: *mut cocos2d_CCArray
< array of children nodes
m_pParent: *mut cocos2d_CCNode
< weak reference to parent node
m_pUserData: *mut c_void
< A user assingned void pointer, Can be point to any cpp object
m_pUserObject: *mut cocos2d_CCObject
< A user assigned CCObject
m_pShaderProgram: *mut cocos2d_CCGLProgram
< OpenGL shader
m_eGLServerState: cocos2d_ccGLServerState
< OpenGL servier side state
m_uOrderOfArrival: c_uint
< used to preserve sequence while sorting children with the same zOrder
m_pScheduler: *mut cocos2d_CCScheduler
< scheduler used to schedule timers and updates
m_pActionManager: *mut cocos2d_CCActionManager
< a pointer to ActionManager singleton, which is used to handle all the actions
m_bRunning: bool
< is running
m_bTransformDirty: bool
< transform dirty flag
m_bInverseDirty: bool
< transform dirty flag
m_bAdditionalTransformDirty: bool
< The flag to check whether the additional transform is dirty
m_bVisible: bool
< is this node visible
m_bIgnoreAnchorPointForPosition: bool
< true if the Anchor Point will be (0,0) when you position the CCNode, false otherwise. < Used by CCLayer and CCScene.
m_bReorderChildDirty: bool
< children order dirty flag
m_nScriptHandler: c_int
< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding.
m_nUpdateScriptHandler: c_int
< script handler for update() callback per frame, which is invoked from lua & javascript.
m_eScriptType: cocos2d_ccScriptType
< type of script binding, lua or javascript
m_pComponentContainer: *mut cocos2d_CCComponentContainer
< Dictionary of components