bool FontManager::load(Path name, sf::Font & dst) { //Fetch the possible locations for this font. DataManager::Paths paths = app->data.paths(Path("fonts") + name); //Try to load the font. bool success = false; for (int i = 0; i < paths.size() && !success; i++) { success = dst.LoadFromFile(paths[i].c_str(), 16); } //Return success. if (success) { LOG(DEBUG, "loaded font '%s'", name.c_str()); } else { LOG(WARNING, "unable to find font '%s'", name.c_str()); } return success; }
bool SoundManager::load(Path name, sf::SoundBuffer & dst) { if (name.str().find(internal_path) == 0) { return true; } else { DataManager::Paths paths = app->data.paths(Path("sounds") + name); paths.push_back(name); bool success = false; for (int i = 0; i < paths.size() && !success; i++) { success = dst.loadFromFile(paths[i].c_str()); } if (success) { LOG(DEBUG, "loaded sound '%s'", name.c_str()); } else { LOG(WARNING, "unable to find sound '%s'", name.c_str()); } return success; } }