| 8 | } |
| 9 | |
| 10 | void Config::loadFromStream(std::string const& filename, std::istream& is) |
| 11 | { |
| 12 | ConfigParser parser; |
| 13 | parser.parse(filename, is); |
| 14 | while (!parser.atEnd()) |
| 15 | { |
| 16 | if (parser.atKVP()) |
| 17 | { |
| 18 | parser.error("KVP without section"); |
| 19 | } |
| 20 | |
| 21 | auto header = parser.getHeader(); |
| 22 | |
| 23 | if (header == "screen") |
| 24 | { |
| 25 | loadScreenSettingsFromStream(parser); |
| 26 | } |
| 27 | else if (header == "keyboard") |
| 28 | { |
| 29 | loadKeybindingsFromStream(parser); |
| 30 | } |
| 31 | else |
| 32 | { |
| 33 | parser.error("Unrecognised section " + header); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | sf::Keyboard::Key Config::getKey(Key_Binds::Control control) const |
| 39 | { |