From f8dafe671252bf87f0486ce833e5436eeee5ce4b Mon Sep 17 00:00:00 2001 From: YuLei Liao Date: Sat, 21 Jan 2012 01:29:41 +0800 Subject: [PATCH] * add CCNode::getChildrenCount() --- cocos2dx/base_nodes/CCNode.cpp | 5 +++++ cocos2dx/include/CCNode.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 1b8fb2c94d..bee81b1a6f 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -319,6 +319,11 @@ CCArray* CCNode::getChildren() return m_pChildren; } +unsigned int CCNode::getChildrenCount(void) +{ + return m_pChildren ? m_pChildren->count() : 0; +} + /// camera getter: lazy alloc CCCamera* CCNode::getCamera() { diff --git a/cocos2dx/include/CCNode.h b/cocos2dx/include/CCNode.h index ad17dec9b7..2496911e48 100755 --- a/cocos2dx/include/CCNode.h +++ b/cocos2dx/include/CCNode.h @@ -191,6 +191,8 @@ class CC_DLL CCNode : public SelectorProtocol, public CCObject CC_PROPERTY_READONLY(CCArray*, m_pChildren, Children) + unsigned int getChildrenCount(void); + /** A CCCamera object that lets you move the node using a gluLookAt */ CC_PROPERTY_READONLY(CCCamera *, m_pCamera, Camera)