CCDictElement is used for traversing CCDictionary.
A CCDictElement is one element of CCDictionary, it contains two properties, key and object. Its key has two different type (integer and string).
#include <Geode/cocos/cocoa/CCDictionary.h>
CCDictElement is used for traversing CCDictionary.
A CCDictElement is one element of CCDictionary, it contains two properties, key and object. Its key has two different type (integer and string).
ℹ The key type is unique, all the elements in CCDictionary has the same key type(integer or string).
CCDictElement* pElement;
CCDICT_FOREACH(dict, pElement)
{
const char*key = pElement->getStrKey();
// You certainly know the type of value, so we assume that it's a CCSprite.
CCSprite* pSprite = (CCSprite*)pElement->getObject();
// ......
}
Get the string key of this element.
ℹ This method assumes you know the key type in the element. If the element's key type is integer, invoking this method will cause an assert.
Get the integer key of this element.
ℹ This method assumes you know the key type in the element. If the element's key type is string, invoking this method will cause an assert.
Get the object of this element.