运行环境coco2d-3.x,android iOS
1,解析如下mgf.cfg文件:
2,代码
bool CfgParse::onMgfCfg(const std::string& strCfgName)
{
g_pInstance_FileUtils->addSearchPath("lng.bundle/");//搜索路径不要忘记
rapidjson::Document doc;
if (MGF_Helper::json_readFromFile(strCfgName, doc)) {
if(doc.HasMember("design"))
{
rapidjson::Value& v=doc["design"];
this->m_nDesignWidth = (t_uint16)MGF_Helper::json_readInt(v, "width", this->m_nDesignWidth);
this->m_nDesignHeight = (t_uint16)MGF_Helper::json_readInt(v, "height", this->m_nDesignHeight);
this->m_nDesignMode = (t_uint16)MGF_Helper::json_readInt(v, "mode", this->m_nDesignMode);
this->m_nDesignFPS = (t_uint16)MGF_Helper::json_readInt(v, "fps", this->m_nDesignFPS);
this->m_bDesignDebug = MGF_Helper::json_readBool(v, "debug", this->m_bDesignDebug);
this->m_bIsPhysicsWorld = MGF_Helper::json