deprecate global getChildOfType

This commit is contained in:
dankmeme01 2024-10-13 14:16:31 +02:00
parent 63e7908413
commit 5f7008072e
2 changed files with 7 additions and 0 deletions

View file

@ -1125,6 +1125,11 @@ public:
GEODE_DLL geode::EventListenerProtocol* getEventListener(std::string const& id);
GEODE_DLL size_t getEventListenerCount();
/**
* Get nth child that is a given type. Checks bounds.
* @returns Child at index cast to the given type,
* or nullptr if index exceeds bounds
*/
template <class T = CCNode>
T* getChildByType(int index) {
size_t indexCounter = 0;

View file

@ -620,7 +620,9 @@ namespace geode::cocos {
* @returns Child at index cast to the given type,
* or nullptr if index exceeds bounds
*/
template <class Type = cocos2d::CCNode>
[[deprecated("Use CCNode::getChildByType instead")]]
static Type* getChildOfType(cocos2d::CCNode* node, int index) {
return node->getChildByType<Type>(index);
}