bool ScrollMenu::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { CCSet set; set.addObject(pTouch); scrollView->ccTouchesBegan(&set, pEvent); return true; }
void CCPrettyPrinter::visit(const CCSet *p) { _result += "\n"; _result += _indentStr; _result += "<set>\n"; setIndentLevel(_indentLevel+1); int i = 0; CCSet* tmp = const_cast<CCSet*>(p); CCSetIterator it = tmp->begin(); for (; it != tmp->end(); ++it, ++i) { if (i > 0) { _result += "\n"; } _result += _indentStr.c_str(); CCPrettyPrinter v(_indentLevel); (*it)->acceptVisitor(v); _result += v.getResult(); } setIndentLevel(_indentLevel-1); _result += "\n"; _result += _indentStr; _result += "</set>\n"; }
Boolean CCEGLView::OnPenUp(EventType* pEvent, Int32 nIndex) { if (m_pDelegate && nIndex < MAX_TOUCHES) { CCTouch* pTouch = s_pTouches[nIndex]; if (pTouch) { CCSet set; pTouch->SetTouchInfo(0, (float)pEvent->sParam1, (float)pEvent->sParam2); set.addObject(pTouch); m_pDelegate->touchesEnded(&set, NULL); pTouch->release(); for (Int32 i = nIndex; i < MAX_TOUCHES; ++i) { if (i != (MAX_TOUCHES - 1)) { s_pTouches[i] = s_pTouches[i + 1]; } else { s_pTouches[i] = NULL; } } } } return FALSE; }
void CCEGLView::OnPointerPressed(int id, const CCPoint& point) { // prepare CCTouch CCTouch* pTouch = m_pTouches[id]; if (! pTouch) { pTouch = new CCTouch(); m_pTouches[id] = pTouch; } // prepare CCSet CCSet* pSet = m_pSets[id]; if (! pSet) { pSet = new CCSet(); m_pSets[id] = pSet; } if (! pTouch || ! pSet) return; float x = point.x; float y = point.y; ConvertPointerCoords(x, y); pTouch->SetTouchInfo(x, y); pSet->addObject(pTouch); m_pDelegate->touchesBegan(pSet, NULL); }
void CCEGLView::onTouchesMove(int id[], float x[], float y[], int pointerNumber) { result r = E_SUCCESS; CCSet set; for(int i = 0 ; i < pointerNumber ; i++ ) { CCLOG("Moving touches with id: %d, x=%f, y=%f", id[i], x[i], y[i]); CCTouch *pTouch = NULL; r = s_mapTouches.GetValue(id[i], pTouch); if (E_SUCCESS == r && pTouch != NULL) { pTouch->SetTouchInfo(0, (x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor , (y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor); set.addObject(pTouch); } else { // It is error, should return. CCLOG("Moving touches with id: %d error", id[i]); return; } } m_pDelegate->touchesMoved(&set, NULL); }
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv* env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) { int size = env->GetArrayLength(ids); jint id[size]; jfloat x[size]; jfloat y[size]; CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort(); CCSet set; env->GetIntArrayRegion(ids, 0, size, id); env->GetFloatArrayRegion(xs, 0, size, x); env->GetFloatArrayRegion(ys, 0, size, y); for( int i = 0 ; i < size ; i++ ) { cocos2d::CCTouch* pTouch = s_pTouches[id[i]]; if (pTouch) { pTouch->SetTouchInfo(0, x[i] - rcRect.origin.x, y[i] - rcRect.origin.y, id[i]); set.addObject(pTouch); s_pTouches[id[i]] = NULL; pTouch->release(); } } cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesCancelled(&set, NULL); }
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv* env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) { int size = env->GetArrayLength(ids); jint id[size]; jfloat x[size]; jfloat y[size]; CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort(); CCSet set; env->GetIntArrayRegion(ids, 0, size, id); env->GetFloatArrayRegion(xs, 0, size, x); env->GetFloatArrayRegion(ys, 0, size, y); for( int i = 0 ; i < size ; i++ ) { LOGD("Moving touches with id: %d, x=%f, y=%f", id[i], x[i], y[i]); cocos2d::CCTouch* pTouch = s_pTouches[id[i]]; if (pTouch) { pTouch->SetTouchInfo(0, x[i] - rcRect.origin.x , y[i] - rcRect.origin.y, id[i]); set.addObject(pTouch); } else { // It is error, should return. LOGD("Moving touches with id: %d error", id[i]); return; } } cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesMoved(&set, NULL); }
Boolean CCEGLView::OnPenMove(EventType* pEvent) { do { CC_BREAK_IF(!m_pDelegate); Int32 nCount = EvtGetPenMultiPointCount(pEvent); CC_BREAK_IF(nCount <= 0 || nCount > MAX_TOUCHES); CCSet set; Int32 nPosX, nPosY; for (Int32 i = 0; i < nCount; ++i) { CCTouch* pTouch = s_pTouches[i]; CC_BREAK_IF(!pTouch); EvtGetPenMultiPointXY(pEvent, i, &nPosX, &nPosY); pTouch->SetTouchInfo(0, (float) nPosX, (float) nPosY); set.addObject(pTouch); } m_pDelegate->touchesMoved(&set, NULL); } while (0); return FALSE; }
void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[]) { CCSet set; for (int i = 0; i < num; ++i) { int id = ids[i]; float x = xs[i]; float y = ys[i]; CCInteger* pIndex = (CCInteger*) s_TouchesIntergerDict.objectForKey(id); int nUnusedIndex = 0; // it is a new touch if (pIndex == NULL) { nUnusedIndex = getUnUsedIndex(); // The touches is more than MAX_TOUCHES ? if (nUnusedIndex == -1) { CCLOG("The touches is more than MAX_TOUCHES, nUnusedIndex = %d", nUnusedIndex); continue; } CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch(); if (m_bIsRetinaEnabled) { // on iOS, though retina is enabled, the value got from os is also // relative to its original size pTouch->setTouchInfo(nUnusedIndex, (x - m_obViewPortRect.origin.x), (y - m_obViewPortRect.origin.y)); } else { pTouch->setTouchInfo(nUnusedIndex, (x - m_obViewPortRect.origin.x) / m_fScaleX, (y - m_obViewPortRect.origin.y) / m_fScaleY); } //CCLOG("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y); CCInteger* pInterObj = new CCInteger(nUnusedIndex); s_TouchesIntergerDict.setObject(pInterObj, id); set.addObject(pTouch); pInterObj->release(); } } if (set.count() == 0) { CCLOG("touchesBegan: count = 0"); return; } m_pDelegate->touchesBegan(&set, NULL); }
void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float xs[], float ys[]) { for (int i = 0; i < num; ++i) { int id = ids[i]; float x = xs[i]; float y = ys[i]; CCInteger* pIndex = (CCInteger*) s_TouchesIntergerDict.objectForKey(id); if (pIndex == NULL) { CCLOG("if the index doesn't exist, it is an error"); continue; } /* Add to the set to send to the director */ CCTouch* pTouch = s_pTouches[pIndex->getValue()]; if (pTouch) { CCLOGINFO("Ending touches with id: %d, x=%f, y=%f", id, x, y); if (m_bIsRetinaEnabled) { pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x), (y - m_obViewPortRect.origin.y)); } else { pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x) / m_fScaleX, (y - m_obViewPortRect.origin.y) / m_fScaleY); } set.addObject(pTouch); // release the object pTouch->release(); s_pTouches[pIndex->getValue()] = NULL; removeUsedIndexBit(pIndex->getValue()); s_TouchesIntergerDict.removeObjectForKey(id); } else { CCLOG("Ending touches with id: %d error", id); return; } } if (set.count() == 0) { CCLOG("touchesEnded or touchesCancel: count = 0"); return; } }
void ScrollMenu::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) { CCSet set; set.addObject(pTouch); scrollView->ccTouchesEnded(&set, pEvent); if(scrollView->getCurrentNodeId() == 0) menuLeft(); else if(scrollView->getCurrentNodeId() == scrollView->endNodeIndex) menuRight(); }
void CCEGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float ys[]) { CCSet set; for (int i = 0; i < num; ++i) { int id = ids[i]; float x = xs[i]; float y = ys[i]; CCInteger* pIndex = (CCInteger*) s_TouchesIntergerDict.objectForKey(id); if (pIndex == NULL) { CCLOG("if the index doesn't exist, it is an error"); continue; } CCLOGINFO("Moving touches with id: %d, x=%f, y=%f", id, x, y); CCTouch* pTouch = s_pTouches[pIndex->getValue()]; if (pTouch) { if (m_bIsRetinaEnabled) { pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x), (y - m_obViewPortRect.origin.y)); } else { pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x) / m_fScaleX, (y - m_obViewPortRect.origin.y) / m_fScaleY); } set.addObject(pTouch); } else { // It is error, should return. CCLOG("Moving touches with id: %d error", id); return; } } if (set.count() == 0) { CCLOG("touchesMoved: count = 0"); return; } m_pDelegate->touchesMoved(&set, NULL); }
void UIScrollLayer::cancelAndStoleTouch(CCTouch* pTouch, CCEvent* pEvent) { // Throw Cancel message for everybody in TouchDispatcher. CCSet* touchSet = new CCSet(); touchSet->addObject(pTouch); touchSet->autorelease(); CCDirector::sharedDirector()->getTouchDispatcher()->touchesCancelled(touchSet, pEvent); //< after doing this touch is already removed from all targeted handlers // Squirrel away the touch claimTouch(pTouch); }
void CCStoreScene::testLoadProducts(CCObject* pSender) { CCSet* productsId = new CCSet(); productsId->autorelease(); CCNative::createAlert("Waiting", "Retrieving Product Information", NULL); CCNative::showAlert(); // SET YOUR IAP PRODUCT ID TO HERE productsId->addObject(newCCString("org.cocos2d-x.games.demo.iap01")); productsId->addObject(newCCString("org.cocos2d-x.games.demo.iap02")); productsId->addObject(newCCString("org.cocos2d-x.games.demo.iap03")); CCStore::sharedStore()->loadProducts(productsId, this); }
bool CC3STBImage::shouldUseForFileExtension( const std::string& fileExtension ) { CCSet* pExtensions = useForFileExtensions(); CCString *pExt; CCSetIterator setIter; for (setIter = pExtensions->begin(); setIter != pExtensions->end(); ++setIter) { pExt = (CCString *)(*setIter); if ( pExt->compare( fileExtension.c_str() ) == 0 ) return true; } return false; }
void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[]) { CCSet set; for (int i = 0; i < num; ++i) { int id = ids[i]; float x = xs[i]; float y = ys[i]; CCInteger* pIndex = (CCInteger*)s_TouchesIntergerDict.objectForKey(id); int nUnusedIndex = 0; // it is a new touch if (pIndex == NULL) { nUnusedIndex = getUnUsedIndex(); // The touches is more than MAX_TOUCHES ? if (nUnusedIndex == -1) { CCLOG("The touches is more than MAX_TOUCHES, nUnusedIndex = %d", nUnusedIndex); continue; } CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch(); pTouch->setTouchInfo(nUnusedIndex, (x - m_obViewPortRect.origin.x) / m_fScaleX, (y - m_obViewPortRect.origin.y) / m_fScaleY); //CCLOG("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y); CCInteger* pInterObj = new CCInteger(nUnusedIndex); s_TouchesIntergerDict.setObject(pInterObj, id); set.addObject(pTouch); pInterObj->release(); } } if (set.count() == 0) { CCLOG("touchesBegan: count = 0"); return; } CCEvent event; CCSet *allTouches= new CCSet; allTouches->autorelease(); getCurrentSetOfTouches(*allTouches); event.setAllTouches(allTouches); m_pDelegate->touchesBegan(&set, &event); }
void App::HandleTouchesEnd(int num, int ids[], float xs[], float ys[]) { int i; int id; float x; float y; CCSet set; CCTouch* pTouch; CCInteger* pIndex; for (i = 0; i < num; ++i) { id = ids[i]; x = xs[i]; y = ys[i]; pIndex = (CCInteger*)s_TouchesIntergerDict.objectForKey(id); if (pIndex == NULL) { CCLOG("if the index doesn't exist, it is an error"); continue; } pTouch = s_pTouches[pIndex->getValue()]; if (pTouch) { CCLOGINFO("Ending touches with id: %d, x=%f, y=%f", id, x, y); pTouch->setTouchInfo(pIndex->getValue(), x, y); set.addObject(pTouch); // release the object pTouch->release(); s_pTouches[pIndex->getValue()] = NULL; removeUsedIndexBit(pIndex->getValue()); s_TouchesIntergerDict.removeObjectForKey(id); } else { CCLOG("Ending touches with id: %d error", id); return; } } CCDirector::sharedDirector()->getTouchDispatcher()->touchesEnded(&set, NULL); }
void App::HandleTouchesBegin(int num, int ids[], float xs[], float ys[]) { int i; int id; int nUnusedIndex; float x; float y; CCSet set; CCTouch* pTouch; CCInteger* pIndex; CCInteger* pInterObj; for (i = 0; i < num; ++i) { id = ids[i]; x = xs[i]; y = ys[i]; pIndex = (CCInteger*)s_TouchesIntergerDict.objectForKey(id); nUnusedIndex = 0; // it is a new touch if (pIndex == NULL) { nUnusedIndex = getUnUsedIndex(); // The touches is more than MAX_TOUCHES ? if (nUnusedIndex == -1) { CCLOG("The touches is more than MAX_TOUCHES, nUnusedIndex = %d", nUnusedIndex); continue; } pTouch = s_pTouches[nUnusedIndex] = new CCTouch(); pTouch->setTouchInfo( nUnusedIndex, x, y ); pInterObj = new CCInteger(nUnusedIndex); s_TouchesIntergerDict.setObject(pInterObj, id); set.addObject(pTouch); pInterObj->release(); } } if (set.count() > 0) { CCDirector::sharedDirector()->getTouchDispatcher()->touchesBegan(&set, NULL); } }
void CCTouchDispatcher::OnPointerOn(const InputPointerEvent* evt) { CCSet set; CCTouch* pTouch = new CCTouch(); pTouch->SetTouchInfo(0, evt->getPos().x, evt->getPos().y); set.addObject(pTouch); m_Touches.insert(std::make_pair(evt->getSource(), pTouch)); pTouch->retain(); // LOG(0, ".. on %.3f %.3f\n", evt->GetPos().x, evt->GetPos().y); touchesBegan(&set); }
CCSet* CCActionManager::pauseAllRunningActions() { CCSet *idsWithActions = new CCSet(); idsWithActions->autorelease(); for (tHashElement *element=m_pTargets; element != NULL; element = (tHashElement *)element->hh.next) { if (! element->paused) { element->paused = true; idsWithActions->addObject(element->target); } } return idsWithActions; }
/** Hackish stuff - stole touches from other CCTouchDispatcher targeted delegates. Used to claim touch without receiving ccTouchBegan. */ void UIScrollLayer::claimTouch(CCTouch* pTouch) { CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher(); CCTargetedTouchHandler* handler = (CCTargetedTouchHandler*)pDispatcher->findHandler(this); if (handler) { CCSet* claimedTouches = handler->getClaimedTouches(); if (!claimedTouches->containsObject(pTouch)) { claimedTouches->addObject(pTouch); } else { CCLOGERROR("CCScrollLayer::claimTouch is already claimed!"); } } }
void CCTouchDispatcher::OnPointerDrag(const InputPointerEvent* evt) { map<Ref<InputPointer>, CCTouch*>::type::iterator itr = m_Touches.find(evt->getSource()); if (itr == m_Touches.end()) return; CCSet set; CCTouch* pTouch = itr->second; pTouch->SetTouchInfo(0, evt->getPos().x, evt->getPos().y); set.addObject(pTouch); // LOG(0, ".. drag %.3f %.3f\n", evt->GetPos().x, evt->GetPos().y); touchesMoved(&set); }
void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float xs[], float ys[]) { for (int i = 0; i < num; ++i) { int id = ids[i]; float x = xs[i]; float y = ys[i]; CC_CONTINUE_IF(s_TouchesIntergerDict.find(id) == s_TouchesIntergerDict.end()); int index = s_TouchesIntergerDict.at(id); /* Add to the set to send to the director */ CATouch* pTouch = s_pTouches[index]; if (pTouch) { CCLOGINFO("Ending touches with id: %d, x=%f, y=%f", id, x, y); pTouch->setTouchInfo(index, (x - m_obViewPortRect.origin.x) / m_fScaleX, (y - m_obViewPortRect.origin.y) / m_fScaleY); set.addObject(pTouch); // release the object pTouch->release(); s_pTouches[index] = NULL; removeUsedIndexBit(index); s_TouchesIntergerDict.erase(id); } else { CCLOG("Ending touches with id: %d error", id); return; } } if (set.count() == 0) { CCLOG("touchesEnded or touchesCancel: count = 0"); return; } }
void TouchGrabber::update(float delta) { mPlayDeltaTime += delta; if (bPlaying == false) return; if (mTouchVecIndice >= mTouchesRecVector.size()) { stop(); return; } TouchRecord rec = mTouchesRecVector.at(mTouchVecIndice); ///CCLOG("rec time: %f play dt: %f",rec.time / 1000.f, mPlayDeltaTime); if (rec.time / 1000.f > mPlayDeltaTime) return; CCTouchDispatcher *dispatcher = CCDirector::sharedDirector()->getTouchDispatcher(); CCSet set; switch (rec.event) { case kTouchBegan: mTouch = new CCTouch(); /// Touch will be destroyed when ended/cancelled mTouch->setTouchInfo(0, rec.x, rec.y); set.addObject(mTouch); dispatcher->touchesBegan(&set, NULL); break; case kTouchMoved: mTouch->setTouchInfo(0, rec.x, rec.y); set.addObject(mTouch); dispatcher->touchesMoved(&set, NULL); break; case kTouchEnded: mTouch->setTouchInfo(0, rec.x, rec.y); set.addObject(mTouch); dispatcher->touchesEnded(&set, NULL); break; case kTouchCancelled: mTouch->setTouchInfo(0, rec.x, rec.y); set.addObject(mTouch); dispatcher->touchesCancelled(&set, NULL); break; default: CCAssert(false, "Unknown touch event."); break; } mTouchVecIndice++; }
void App::HandleTouchesMove(int num, int ids[], float xs[], float ys[]) { int i; int id; float x; float y; CCSet set; CCTouch* pTouch; CCInteger* pIndex; for (i = 0; i < num; ++i) { id = ids[i]; x = xs[i]; y = ys[i]; pIndex = (CCInteger*)s_TouchesIntergerDict.objectForKey(id); if (pIndex == NULL) { CCLOG("if the index doesn't exist, it is an error"); continue; } CCLOGINFO("Moving touches with id: %d, x=%f, y=%f", id, x, y); pTouch = s_pTouches[pIndex->getValue()]; if (pTouch) { pTouch->setTouchInfo(pIndex->getValue(), x, y); set.addObject(pTouch); } else { // It is error, should return. CCLOG("Moving touches with id: %d error", id); return; } } if (set.count() > 0) { CCDirector::sharedDirector()->getTouchDispatcher()->touchesMoved(&set, NULL); } }
void CCEGLView::OnPointerReleased(int id, const CCPoint& point) { CCTouch* pTouch = m_pTouches[id]; CCSet* pSet = m_pSets[id]; if (! pTouch || ! pSet) return; float x = point.x; float y = point.y; ConvertPointerCoords(x, y); pTouch->SetTouchInfo(x, y); m_pDelegate->touchesEnded(pSet, NULL); pSet->removeObject(pTouch); CC_SAFE_DELETE(m_pTouches[id]); CC_SAFE_DELETE(m_pSets[id]); }
Boolean CCEGLView::OnPenDown(EventType* pEvent, Int32 nIndex) { if (m_pDelegate && nIndex < MAX_TOUCHES) { CCTouch* pTouch = s_pTouches[nIndex]; if (!pTouch) { pTouch = new CCTouch; } pTouch->SetTouchInfo(0, (float)pEvent->sParam1, (float)pEvent->sParam2); s_pTouches[nIndex] = pTouch; CCSet set; set.addObject(pTouch); m_pDelegate->touchesBegan(&set, NULL); } return FALSE; }
void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[]) { CCSet set; for (int i = 0; i < num; ++i) { int id = ids[i]; float x = xs[i]; float y = ys[i]; int nUnusedIndex = 0; // it is a new touch if (s_TouchesIntergerDict.find(id) == s_TouchesIntergerDict.end()) { nUnusedIndex = getUnUsedIndex(); // The touches is more than MAX_TOUCHES ? if (nUnusedIndex == -1) { CCLOG("The touches is more than MAX_TOUCHES, nUnusedIndex = %d", nUnusedIndex); continue; } CATouch* pTouch = s_pTouches[nUnusedIndex] = new CATouch(); pTouch->setTouchInfo(nUnusedIndex, (x - m_obViewPortRect.origin.x) / m_fScaleX, (y - m_obViewPortRect.origin.y) / m_fScaleY); s_TouchesIntergerDict.insert(std::make_pair(id, nUnusedIndex)); set.addObject(pTouch); } } if (set.count() == 0) { CCLOG("touchesBegan: count = 0"); return; } m_pDelegate->touchesBegan(&set, NULL); }
void CCEGLView::onTouchesEnd(int id[], float x[], float y[], int pointerNumber) { result r = E_SUCCESS; CCSet set; for(int i = 0 ; i < pointerNumber ; i++ ) { CCTouch *pTouch = NULL; r = s_mapTouches.GetValue(id[i], pTouch); if (E_SUCCESS == r && pTouch != NULL) { pTouch->SetTouchInfo(0, (x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor , (y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor); set.addObject(pTouch); s_mapTouches.Remove(id[i]); pTouch->release(); CCLOG("Ending touches with id: %d, x=%f, y=%f, retain count = %d", id[i], x[i], y[i], pTouch->retainCount()); } } m_pDelegate->touchesEnded(&set, NULL); }
void PrettyPrinterDemo::onEnter() { CCLayer::onEnter(); CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28); label->setPosition( ccp(s.width/2, s.height * 4/5) ); this->addChild(label, 1); std::string strSubtitle = subtitle(); if(strSubtitle.empty() == false) { CCLabelTTF* subLabel = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16); subLabel->setPosition( ccp(s.width/2, s.height * 3/5) ); this->addChild(subLabel, 1); } // Test code CCPrettyPrinter vistor; // print dictionary CCDictionary* pDict = CCDictionary::createWithContentsOfFile("animations/animations.plist"); pDict->acceptVisitor(vistor); CCLog("%s", vistor.getResult().c_str()); CCLog("-------------------------------"); CCSet myset; for (int i = 0; i < 30; ++i) { myset.addObject(CCString::createWithFormat("str: %d", i)); } vistor.clear(); myset.acceptVisitor(vistor); CCLog("%s", vistor.getResult().c_str()); CCLog("-------------------------------"); vistor.clear(); addSprite(); pDict = CCTextureCache::sharedTextureCache()->snapshotTextures(); pDict->acceptVisitor(vistor); CCLog("%s", vistor.getResult().c_str()); }