From 493d95c3f64f19896debff4a8e150c9fa67e3eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=B6sel?= Date: Sat, 10 Oct 2015 00:08:38 +0200 Subject: [PATCH] Add missing getChildByTag<>() api --- cocos/2d/CCNode.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 93cb2e2a7d..4a521f81c7 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -769,6 +769,17 @@ public: * Please use `getChildByName()` instead. */ virtual Node * getChildByTag(int tag) const; + + /** + * Gets a child from the container with its tag that can be cast to Type T. + * + * @param tag An identifier to find the child node. + * + * @return a Node with the given tag that can be cast to Type T. + */ + template + inline T getChildByTag(int tag) const { return static_cast(getChildByTag(tag)); } + /** * Gets a child from the container with its name. *