本文整理汇总了C++中DataReader::getStringFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ DataReader::getStringFromFile方法的具体用法?C++ DataReader::getStringFromFile怎么用?C++ DataReader::getStringFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataReader
的用法示例。
在下文中一共展示了DataReader::getStringFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSounds
void GameSound::loadSounds()
{
DataReader * data = DataReader::getInstance();
filenames[BOMB_FUSE] = data->getStringFromFile("BOMB_FUSE", "data/audio.txt");
filenames[EGG_DROP] = data->getStringFromFile("EGG_DROP", "data/audio.txt");
filenames[MINE_DROP] = data->getStringFromFile("MINE_DROP", "data/audio.txt");
filenames[BLOCK_DROP] = data->getStringFromFile("BLOCK_DROP", "data/audio.txt");
filenames[BOOM] = data->getStringFromFile("BOOM", "data/audio.txt");
filenames[MUNCHY] = data->getStringFromFile("MUNCHY", "data/audio.txt");
filenames[ENERGY_DROP] = data->getStringFromFile("ENERGY_DROP", "data/audio.txt");
filenames[ENERGY_PICKUP] = data->getStringFromFile("ENERGY_PICKUP", "data/audio.txt");
filenames[EGG_STOLEN] = data->getStringFromFile("EGG_STOLEN", "data/audio.txt");
filenames[SPLAT] = data->getStringFromFile("SPLAT", "data/audio.txt");
filenames[ROCKET_SPIN] = data->getStringFromFile("ROCKET_SPIN", "data/audio.txt");
filenames[ROCKET_FIRED] = data->getStringFromFile("ROCKET_FIRED", "data/audio.txt");
filenames[ROBOT_CREATE] = data->getStringFromFile("ROBOT_CREATE", "data/audio.txt");
filenames[THIEF_CREATE] = data->getStringFromFile("THIEF_CREATE", "data/audio.txt");
filenames[EATER_CREATE] = data->getStringFromFile("EATER_CREATE", "data/audio.txt");
filenames[DRONE_CREATE] = data->getStringFromFile("DRONE_CREATE", "data/audio.txt");
// check files exist
string empty;
for (int i = 0; i < FINAL_ENTRY_SOUND_NAME; ++i)
{
if (filenames[i] != empty)
{
// valid entry, check it exists
if (!MickUtil::CheckFileExists(filenames[i].c_str()))
{
// file doesn't exist
std::stringstream error;
error << "File: " << filenames[i].c_str() << " is not found.";
cerr << error.str();
return; //why don't we want to know about everything that's missing
}
}
}
}