LoginSignup
11
11

More than 5 years have passed since last update.

【cocos2d-x】CCDictionaryの中身をすべて取り出す

Last updated at Posted at 2013-01-26

cocos2d-xでモデルまわりをどうしようかなぁと。

    CCDictionary *dictionary = CCDictionary::create();
    dictionary->setObject(CCString::create("testObject1"),"testKey1");
    dictionary->setObject(CCString::create("testObject2"),"testKey2");

    CCArray *keys = dictionary->allKeys();
    CCObject *key;
    CCARRAY_FOREACH(keys, key){
        CCString *keyString = (CCString *)key;
        CCLOG("key -> %s" , keyString -> getCString() );
        CCString *objectString = (CCString *)dictionary -> objectForKey(keyString->getCString());
        CCLOG("object -> %s", objectString -> getCString() );
    }

んーん、CCARRAY_FOREACH便利だけど、変数がなぁ。。。

11
11
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11