本文整理汇总了C++中json::value::iterator::asString方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::asString方法的具体用法?C++ iterator::asString怎么用?C++ iterator::asString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::value::iterator
的用法示例。
在下文中一共展示了iterator::asString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadResources
void Game::loadResources() {
Log::Out << "Game: Loading resources..." << endl;
istream* resourcesFile = Pack::GetInstance()->GetStream("resources.json");
if (!resourcesFile->good()) {
Log::Out << "Couldn't load file resources.json" << endl;
return;
}
Json::Value root;
(*resourcesFile) >> root;
delete resourcesFile;
Log::Out << "Game: Initializing Scanlines..." << endl;
Json::Value shaders = root["outputShaders"];
if (Json::Value::null != shaders) {
ShaderMgr* shaderMgr = ShaderMgr::GetInstance();
for (Json::Value::iterator itShaderDesc = shaders.begin(); itShaderDesc != shaders.end(); ++itShaderDesc) {
vector<Shader*> shaderPtrs;
Json::Value child = *itShaderDesc;
string name = child["name"].asString();
Json::Value pathArray = child["shaderPaths"];
for (Json::Value::iterator itShaderPath = pathArray.begin(); itShaderPath != pathArray.end(); ++itShaderPath) {
string shaderFile = itShaderPath->asString();
ShaderType shaderType = shaderFile.find(".vertex") == string::npos ? Fragment : Vertex;
stringstream ss;
ss << "Loading " << ((shaderType == Vertex) ? "vertex" : "fragment") << " shader: " << shaderFile;
drawStatusMsg(ss.str());
shaderPtrs.push_back(shaderMgr->LoadShader(shaderFile, shaderType));
}
Program* p = new Program(shaderPtrs);
if (p->ProgramId != 0) {
p->Textures.push_back(_g->GetFramebufferTexture());
}
Json::Value texArray = child["additionalTextures"];
for (Json::Value::iterator itTexturePath = texArray.begin(); itTexturePath != texArray.end(); ++itTexturePath) {
string texPath = itTexturePath->asString();
p->Textures.push_back(Frame(texPath).Texture);
}
this->_blitProgramMap[name] = p;
if (child.isMember("default") && child["default"].asBool()) {
this->_blitProgram = p;
}
}
if (this->_blitProgram == NULL && this->_blitProgramMap.size() > 0) {
this->_blitProgram = (this->_blitProgramMap.end())->second;
}
}
Json::Value images = root["images"];
if (Json::Value::null != images) {
TextureMgr* texMgr = TextureMgr::GetInstance();
for (Json::Value::iterator img = images.begin(); img != images.end(); ++img) {
string file = img->asString();
stringstream ss;
ss << "Loading image: " << file;
drawStatusMsg(ss.str());
texMgr->LoadTexture(file);
}
}
Json::Value music = root["music"];
if (Json::Value::null != music) {
MusicManager* musicMgr = MusicManager::GetInstance();
for (Json::Value::iterator mus = music.begin(); mus != music.end(); ++mus) {
string file = mus->asString();
stringstream ss;
ss << "Loading song " << file;
drawStatusMsg(ss.str());
musicMgr->LoadMusic(mus->asString());
}
}
Json::Value effects = root["fx"];
if (Json::Value::null != effects) {
MusicManager* musicMgr = MusicManager::GetInstance();
for (Json::Value::iterator fx = effects.begin(); fx != effects.end(); ++fx) {
stringstream ss;
string file = fx->asString();
ss << "Loading effect " << file;
drawStatusMsg(ss.str());
musicMgr->LoadMusic(fx->asString());
}
}
drawStatusMsg("Done!");
}