| 33 | |
| 34 | namespace { |
| 35 | void loadConfig(Config &config) |
| 36 | { |
| 37 | std::ifstream configFile("config.txt"); |
| 38 | std::string key; |
| 39 | |
| 40 | if (configFile.is_open()) { |
| 41 | while (configFile >> key) { |
| 42 | if (key == "renderdistance") { |
| 43 | configFile >> config.renderDistance; |
| 44 | std::cout << "Config: Render Distance: " |
| 45 | << config.renderDistance << '\n'; |
| 46 | } |
| 47 | else if (key == "fullscreen") { |
| 48 | configFile >> config.isFullscreen; |
| 49 | std::cout << "Config: Full screen mode: " << std::boolalpha |
| 50 | << config.isFullscreen << '\n'; |
| 51 | } |
| 52 | else if (key == "windowsize") { |
| 53 | configFile >> config.windowX >> config.windowY; |
| 54 | std::cout << "Config: Window Size: " << config.windowX << " x " |
| 55 | << config.windowY << '\n'; |
| 56 | } |
| 57 | else if (key == "fov") { |
| 58 | configFile >> config.fov; |
| 59 | std::cout << "Config: Field of Vision: " << config.fov << '\n'; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | else { |
| 64 | std::cerr << "Error: Could not find config.txt file! Using defaults.\n"; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | void displayInfo() |
| 69 | { |