// 初始化節點對象
virtual bool init();
// 分配內存並初始化節點對象
static CCNode * create(void);
// 節點描述
const char* description(void);
// 設置z-order,隻影響節點繪製順序,與OpenGL的z值無關
virtual void setZOrder(int zOrder);
// 獲取節點的z-order值
virtual int getZOrder();
// 設置節點OpenGL的z值
virtual void setVertexZ(float vertexZ);
// 獲取節點的OpenGL的座標z值
virtual float getVertexZ();
// 設置x放縮係數
virtual void setScaleX(float fScaleX);
// 獲取節點的放縮係數
virtual float getScaleX();
// 設置y值放縮係數
virtual void setScaleY(float fScaleY);
// 設置y放縮係數
virtual float getScaleY();
// 設置節點放縮比例,同時影響x,y值
virtual void setScale(float scale);
// 獲取節點放縮比例,同時影響x,y值
virtual float getScale();
// 設置節點放縮比例,同時影響x,y值
virtual void setScale(float fScaleX,float fScaleY);
// 設置節點的位置,在OpenGL座標系中
virtual void setPosition(const CCPoint &position);
virtual void setPosition(float x, float y);
// 獲取節點在OpenGL座標系下節點座標值
virtual const CCPoint& getPosition();
virtual void getPosition(float* x, float* y);
// 設置單個座標x,y值
virtual void setPositionX(float x);
virtual float getPositionX(void);
virtual void setPositionY(float y);
virtual float getPositionY(void);
// 設置x的扭曲角度,獲取x的扭曲角度
virtual void setSkewX(float fSkewX);
virtual float getSkewX();
// 設置x的扭曲角度,獲取x的扭曲角度
virtual void setSkewY(float fSkewY);
virtual float getSkewY();
// 設置錨點位置,獲取錨點位置
virtual void setAnchorPoint(const CCPoint& anchorPoint);
virtual const CCPoint& getAnchorPoint();
// 在絕對像素下,獲取錨點位置,
virtual const CCPoint& getAnchorPointInPoints();
// 設置節點的大小,獲取節點大小(都是未變化前的大小)
virtual void setContentSize(const CCSize& contentSize);
virtual const CCSize& getContentSize() const;
// 設置節點可見性,詢問節點可見性
virtual void setVisible(bool visible);
virtual bool isVisible();
// 設置節點旋轉的角度,獲取節點的旋轉角度
virtual void setRotation(float fRotation);
virtual float getRotation();
// 設置及獲取旋轉角度單個值x,y
virtual void setRotationX(float fRotaionX);
virtual float getRotationX();
virtual void setRotationY(float fRotationY);
virtual float getRotationY();
// 設置、獲取節點的到達順序,只有在z-order相同的情況下,才比較他,而且擁有較大值uOrderOfArrival得戒掉後被繪製
virtual void setOrderOfArrival(unsigned int uOrderOfArrival);
virtual unsigned int getOrderOfArrival();
// 設置、獲取OpenGL環境的服務狀態
virtual void setGLServerState(ccGLServerState glServerState);
virtual ccGLServerState getGLServerState();
// 設置、獲取忽略錨點與否
virtual void ignoreAnchorPointForPosition(bool ignore);
virtual bool isIgnoreAnchorPointForPosition();
// 向該節點添加子節點
virtual void addChild(CCNode * child);
// 向該節點添加子節點,並指定z-order值
virtual void addChild(CCNode * child, int zOrder);
// 添加子節點,指定zorder值,並打上標記tag
virtual void addChild(CCNode* child, int zOrder, int tag);
// 根據tag標記獲取節點對象
CCNode * getChildByTag(int tag);
// 獲取所有的子節點對象
virtual CCArray* getChildren();
// 獲取子節點數目
unsigned int getChildrenCount(void) const;
// 設置、獲取父節點
virtual void setParent(CCNode* parent);
virtual CCNode* getParent();
// 從父節點移除該節點和與節點綁定的動作
virtual void removeFromParent();
virtual void removeFromParentAndCleanup(bool cleanup);
// 移除該節點指定的子節點和子節點對應的動作序列
virtual void removeChild(CCNode* child);
virtual void removeChild(CCNode* child, bool cleanup);
// 通過tag值移除指定的額子節點和對應的動作序列
virtual void removeChildByTag(int tag);
virtual void removeChildByTag(int tag, bool cleanup);
// 移除所有的子節點並清空動作序列
virtual void removeAllChildren();
virtual void removeAllChildrenWithCleanup(bool cleanup);
// 重新定義節點的zorder值
virtual void reorderChild(CCNode * child, int zOrder);
// 在繪製節點前對所有的子節點進行排序
virtual void sortAllChildren();
// 返回、設置一個grid對象,用於演示各種效果時
virtual CCGridBase* getGrid();
virtual void setGrid(CCGridBase *pGrid);
// 獲取、設置節點標記
virtual int getTag() const;
virtual void setTag(int nTag);
// 獲取、設置用戶數據指針
virtual void* getUserData();
virtual void setUserData(void *pUserData);
// 返回、設置一個賦值的CCObject對象
virtual CCObject* getUserObject();
virtual void setUserObject(CCObject *pUserObject);
// 返回、設置該節點的shader
virtual CCGLProgram* getShaderProgram();
virtual void setShaderProgram(CCGLProgram *pShaderProgram);
// 獲取該節點的攝像機,CCCamera object that lets you move the node using a gluLookAt
virtual CCCamera* getCamera();
// 查詢該節點是否接受回調函數,如onEnter(), onExit(), update()
virtual bool isRunning();
// 註冊腳本函數的handler,以便在onEnter() & onExit()調用
virtual void registerScriptHandler(int handler);
// 銷燬註冊的腳本函數
virtual void unregisterScriptHandler(void);
// 獲取腳本入口的handler
inline int getScriptHandler() { return m_nScriptHandler; };
// 用來供lua腳本調用
void scheduleUpdateWithPriorityLua(int nHandler, int priority);
// 當節點進入舞臺後每幀都會調用,在該節點執行各種變化時,重寫該方法時要調用父節點的該方法
virtual void onEnter();
// 當節點執行完各種動作變化後,執行該回調函數
virtual void onEnterTransitionDidFinish();
// 節點離開舞臺後,執行該函數
virtual void onExit();
// 在節點退出舞臺時,這裏的變化動作執行之前
virtual void onExitTransitionDidStart();
// 停止所有動作和調度函數
virtual void cleanup(void);
// 重寫該方法來繪製你自己的節點對象
virtual void draw(void);
// 訪問該節點的子節點並遞歸繪製他們
virtual void visit(void);
// 返回該節點的綁定盒子,該盒子相對於父節點的
CCRect boundingBox(void);
// 設置、獲取該節點的動作管理器用於所有的動作序列
virtual void setActionManager(CCActionManager* actionManager);
virtual CCActionManager* getActionManager();
// 執行該節點綁定的動作序列,並返回該動作序列
CCAction* runAction(CCAction* action);
// 停止所有的節點對象,並移除所有的動作序列
void stopAllActions(void);
// 停止某個動作序列並移除之
void stopAction(CCAction* action);
// 根據給定的tag移除動作序列
void stopActionByTag(int tag);
// 根據給定的tag獲取指定的動作序列
CCAction* getActionByTag(int tag);
// 返回該節點運行的動作序列的數目,
// If you are running 1 Sequence of 7 actions, it will return 1.If you are running 7 Sequences of 2 actions, it will return 7.
unsigned int numberOfRunningActions(void);
// 設置、獲取該節點的調度對象用來調度所有的"updates" and timers
virtual void setScheduler(CCScheduler* scheduler);
virtual CCScheduler* getScheduler();
// 查詢一個調度對象是否正在被調度
bool isScheduled(SEL_SCHEDULE selector);
// 定時調度update方法,每幀都會調用,擁有較小order值的會先於較大的調用
void scheduleUpdate(void);
// 定時刷新調度update方法,根據優先級調度
void scheduleUpdateWithPriority(int priority);
// 停止調度update方法
void unscheduleUpdate(void);
// 調度一個自定義的函數,函數-間隔時間-次數-等待時間
void schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay);
void schedule(SEL_SCHEDULE selector, float interval);
// 延遲時間調度
void scheduleOnce(SEL_SCHEDULE selector, float delay);
// 每幀調度
void schedule(SEL_SCHEDULE selector);
// 停止自定義的調度
void unschedule(SEL_SCHEDULE selector);
// 關閉所有的調度函數
void unscheduleAllSelectors(void);
// 重新開啓所有的調度函數和動作序列onEnter
void resumeSchedulerAndActions(void);
// 暫停調度和所有的動作序列onExit
void pauseSchedulerAndActions(void);
// 每幀調度該函數,如果節點存在的話
virtual void update(float delta);
// 執行OpenGL的視圖矩陣變換
void transform(void);
// 視圖變換,包括父母的
void transformAncestors(void);
// 調用子節點的變換
virtual void updateTransform(void);
// 返回矩陣,從子節點座標系到父節點座標系轉換的矩陣
virtual CCAffineTransform nodeToParentTransform(void);
// 從父節點座標系轉換到子節點座標系的轉換矩陣
virtual CCAffineTransform parentToNodeTransform(void);
// 到世界矩陣的變換矩陣
virtual CCAffineTransform nodeToWorldTransform(void);
// 返回到世界矩陣的變換矩陣的逆矩陣
virtual CCAffineTransform worldToNodeTransform(void);
// 轉換到本地座標系
CCPoint convertToNodeSpace(const CCPoint& worldPoint);
// 轉換到世界座標系
CCPoint convertToWorldSpace(const CCPoint& nodePoint);
// 轉換點到本地座標系中,返回值與錨點相關的
CCPoint convertToNodeSpaceAR(const CCPoint& worldPoint);
// 轉換本地座標系的節點的位置到世界座標系中,與錨點相關的
CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint);
// 講觸摸對象轉換爲本地座標系
CCPoint convertTouchToNodeSpace(CCTouch * touch);
// 轉換觸摸對象到本地座標系中,與錨點相關的
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch);
// 設置附加的矩陣變化,常用來摸底父子節點的關係,獲取精靈a的變化,並應用於精靈b上,精靈b位置依賴於a的父節點
void setAdditionalTransform(const CCAffineTransform& additionalTransform);
// 通過名字獲取分量
CCComponent* getComponent(const char *pName) const;
// 添加一個分量
virtual bool addComponent(CCComponent *pComponent);
// 移除一個分量
virtual bool removeComponent(const char *pName);
// 移除所有的分量
virtual void removeAllComponents();
// 屬性:
float m_fRotationX; ///< rotation angle on x-axis
float m_fRotationY; ///< rotation angle on y-axis
float m_fScaleX; ///< scaling factor on x-axis
float m_fScaleY; ///< scaling factor on y-axis
float m_fVertexZ; ///< OpenGL real Z vertex
CCPoint m_obPosition; ///< position of the node
float m_fSkewX; ///< skew angle on x-axis
float m_fSkewY; ///< skew angle on y-axis
CCPoint m_obAnchorPointInPoints; ///< anchor point in points
CCPoint m_obAnchorPoint; ///< anchor point normalized (NOT in points)
CCSize m_obContentSize; ///< untransformed size of the node
CCAffineTransform m_sAdditionalTransform; ///< transform
CCAffineTransform m_sTransform; ///< transform
CCAffineTransform m_sInverse; ///< transform
CCCamera *m_pCamera; ///< a camera
CCGridBase *m_pGrid; ///< a grid
int m_nZOrder; ///< z-order value that affects the draw order
CCArray *m_pChildren; ///< array of children nodes
CCNode *m_pParent; ///< weak reference to parent node
int m_nTag; ///< a tag. Can be any number you assigned just to identify this node
void *m_pUserData; ///< A user assingned void pointer, Can be point to any cpp object
CCObject *m_pUserObject; ///< A user assigned CCObject
CCGLProgram *m_pShaderProgram; ///< OpenGL shader
ccGLServerState m_eGLServerState; ///< OpenGL servier side state
unsigned int m_uOrderOfArrival; ///< used to preserve sequence while sorting children with the same zOrder
CCScheduler *m_pScheduler; ///< scheduler used to schedule timers and updates
CCActionManager *m_pActionManager; ///< a pointer to ActionManager singleton, which is used to handle all the actions
bool m_bRunning; ///< is running
bool m_bTransformDirty; ///< transform dirty flag
bool m_bInverseDirty; ///< transform dirty flag
bool m_bAdditionalTransformDirty; ///< The flag to check whether the additional transform is dirty
bool m_bVisible; ///< is this node visible
bool m_bIgnoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the CCNode, false otherwise.
///< Used by CCLayer and CCScene.
bool m_bReorderChildDirty; ///< children order dirty flag
int m_nScriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding.
int m_nUpdateScriptHandler; ///< script handler for update() callback per frame, which is invoked from lua & javascript.
ccScriptType m_eScriptType; ///< type of script binding, lua or javascript
CCComponentContainer *m_pComponentContainer; ///< Dictionary of components
};
class CC_DLL CCNodeRGBA : public CCNode, public CCRGBAProtocol
{
public:
CCNodeRGBA();
virtual ~CCNodeRGBA();
virtual bool init();
// 分配內存並初始化節點對象
static CCNodeRGBA * create(void);
// 透明度相關
virtual GLubyte getOpacity();
virtual GLubyte getDisplayedOpacity();
virtual void setOpacity(GLubyte opacity);
virtual void updateDisplayedOpacity(GLubyte parentOpacity);
virtual bool isCascadeOpacityEnabled();
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
// 顏色相關的
virtual const ccColor3B& getColor(void);
virtual const ccColor3B& getDisplayedColor();
virtual void setColor(const ccColor3B& color);
virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual bool isCascadeColorEnabled();
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);};
virtual bool isOpacityModifyRGB() { return false; };
};
CCNode類
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.