31 : mSkyX(s), mController(c), mCamera(d)
41 std::pair<bool, Ogre::ConfigFile> CfgFileResult;
44 if (!CfgFileResult.first)
49 Ogre::ConfigFile &CfgFile = CfgFileResult.second;
130 "#SkyX cfg file.\n\n";
132 Data +=
"#SkyX version field\n";
140 FILE *DestinationFile = fopen((Path+
"/"+File).c_str(),
"w");
142 if (!DestinationFile)
147 fprintf(DestinationFile,
"%s", Data.c_str());
148 fclose(DestinationFile);
150 SkyXLOG(File +
" saved in " + Path +
" .");
159 Result.second.load(Ogre::ResourceGroupManager::getSingleton().openResource(File, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME));
164 SkyXLOG(
"CfgFileManager::_getCfgFile(...): " + File +
" not found in any resource group.");
165 Result.first =
false;
173 return "<int>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
178 return "<float>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
183 return "<bool>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
188 return "<vector2>" + Name +
"=" + Ogre::StringConverter::toString(Value.x) +
"x" + Ogre::StringConverter::toString(Value.y) +
"\n";
193 return "<vector3>" + Name +
"=" + Ogre::StringConverter::toString(Value.x) +
"x" + Ogre::StringConverter::toString(Value.y) +
"x" + Ogre::StringConverter::toString(Value.z) +
"\n";
198 return "<vector4>" + Name +
"=" + Ogre::StringConverter::toString(Value.x) +
"x" + Ogre::StringConverter::toString(Value.y) +
"x" + Ogre::StringConverter::toString(Value.z) +
"x" + Ogre::StringConverter::toString(Value.w) +
"\n";
203 return "<degree>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
208 for (
unsigned int k = 0; k < List.size(); k++)
221 return "SkyXVersion=" +
234 if(CfgFile.getSetting(
"HydraxVersion") != (
242 HydraxLOG(
"Config file version doesn't correspond with Hydrax version.");
252 Ogre::String Value = CfgFile.getSetting(
"<int>" + Name);
260 return Ogre::StringConverter::parseInt(Value);
266 Ogre::String Value = CfgFile.getSetting(
"<float>" + Name);
274 return Ogre::StringConverter::parseReal(Value);
280 Ogre::String Value = CfgFile.getSetting(
"<bool>" + Name);
288 return Ogre::StringConverter::parseBool(Value);
294 Ogre::String Value = CfgFile.getSetting(
"<vector2>" + Name);
298 return Ogre::Vector2(0,0);
302 return Ogre::Vector2(Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[0]),
303 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[1]));
309 Ogre::String Value = CfgFile.getSetting(
"<vector3>" + Name);
313 return Ogre::Vector3(0,0,0);
317 return Ogre::Vector3(Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[0]),
318 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[1]),
319 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[2]));
325 Ogre::String Value = CfgFile.getSetting(
"<vector4>" + Name);
329 return Ogre::Vector4(0, 0, 0, 0);
333 return Ogre::Vector4(
334 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[0]),
335 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[1]),
336 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[2]),
337 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[3])
344 Ogre::String Value = CfgFile.getSetting(
"<degree>" + Name);
348 return Ogre::Degree(0);
352 return Ogre::Degree(Ogre::StringConverter::parseReal(Value));