diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index 33883629..88ea5b8f 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -903,6 +903,12 @@ namespace geode::cocos { } }; + template + concept CocosObjectPtr = std::is_pointer_v && std::is_convertible_v; + + template + concept CocosDictionaryKey = std::same_as || std::same_as || std::same_as || std::same_as; + /** * A templated wrapper over CCArray, providing easy iteration and indexing. * This will keep ownership of the given CCArray*. @@ -914,12 +920,12 @@ namespace geode::cocos { * // Easy indexing, giving you the type you assigned * GameObject* myObj = objects[2]; * - * // Easy iteration using c++ range-based for loops + * // Easy iteration using C++ range-based for loops * for (auto* obj : objects) { * log::info("{}", obj->m_objectID); * } */ - template + template class CCArrayExt { protected: Ref m_arr; @@ -1055,12 +1061,12 @@ namespace geode::cocos { * // Easy indexing, giving you the type you assigned * GJGameLevel* myLvl = levels["Cube Adventures"]; * - * // Easy iteration using c++ range-based for loops + * // Easy iteration using C++ range-based for loops * for (auto [name, level] : levels) { * log::info("{}: {}", name, level->m_levelID); * } */ - template + template struct CCDictionaryExt { protected: Ref m_dict; @@ -1103,5 +1109,9 @@ namespace geode::cocos { size_t count(const Key& key) { return this->contains(key) ? 1 : 0; } + + cocos2d::CCDictionary* inner() { + return m_dict; + } }; }