1 /* Preferences.h 2 Copyright (c) 2014 by Michael Zahniser 3 4 Endless Sky is free software: you can redistribute it and/or modify it under the 5 terms of the GNU General Public License as published by the Free Software 6 Foundation, either version 3 of the License, or (at your option) any later version. 7 8 Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY 9 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 10 PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 */ 12 13 #ifndef PREFERENCES_H_ 14 #define PREFERENCES_H_ 15 16 #include <string> 17 18 19 20 class Preferences { 21 public: 22 enum class VSync : int { 23 off = 0, 24 on, 25 adaptive, 26 }; 27 28 29 public: 30 static void Load(); 31 static void Save(); 32 33 static bool Has(const std::string &name); 34 static void Set(const std::string &name, bool on = true); 35 36 // Toggle the ammo usage preferences, cycling between "never," "frugally," 37 // and "always." 38 static void ToggleAmmoUsage(); 39 static std::string AmmoUsage(); 40 41 // Scroll speed preference. 42 static int ScrollSpeed(); 43 static void SetScrollSpeed(int speed); 44 45 // View zoom. 46 static double ViewZoom(); 47 static bool ZoomViewIn(); 48 static bool ZoomViewOut(); 49 50 // VSync setting, either "on", "off", or "adaptive". 51 static bool ToggleVSync(); 52 static Preferences::VSync VSyncState(); 53 static const std::string &VSyncSetting(); 54 }; 55 56 57 58 #endif 59