本文整理汇总了C++中CCDictionary::acceptVisitor方法的典型用法代码示例。如果您正苦于以下问题:C++ CCDictionary::acceptVisitor方法的具体用法?C++ CCDictionary::acceptVisitor怎么用?C++ CCDictionary::acceptVisitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCDictionary
的用法示例。
在下文中一共展示了CCDictionary::acceptVisitor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
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());
}