1 /* 2 Copyright (C) 2009 Andrew Caudwell (acaudwell@gmail.com) 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 7 3 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef SDLAPP_SETTINGS_H 19 #define SDLAPP_SETTINGS_H 20 21 #include "conffile.h" 22 23 #include <map> 24 #include <vector> 25 #include <string> 26 27 class SDLAppSettings { 28 protected: 29 std::string default_section_name; 30 31 std::map<std::string, std::string> arg_types; 32 std::map<std::string, std::string> arg_aliases; 33 std::map<std::string, std::string> conf_sections; 34 commandLineOption(const std::string & name,const std::string & value)35 virtual void commandLineOption(const std::string& name, const std::string& value) {} 36 37 bool parseRectangle(const std::string& value, int& x, int& y); 38 bool parseViewport(const std::string& value, int& x, int& y, bool& no_resize); 39 bool parseDateTime(const std::string& datetime, time_t& timestamp); 40 public: 41 int display_width; 42 int display_height; 43 int window_x; 44 int window_y; 45 int screen; 46 bool multisample; 47 bool fullscreen; 48 bool frameless; 49 bool transparent; 50 bool resizable; 51 bool vsync; 52 53 std::string output_ppm_filename; 54 int output_framerate; 55 56 SDLAppSettings(); 57 58 void parseArgs(int argc, char *argv[], ConfFile& conffile, std::vector<std::string>* files = 0); 59 void parseArgs(const std::vector<std::string>& args, ConfFile& conffile, std::vector<std::string>* files = 0); 60 61 void exportDisplaySettings(ConfFile& conf); 62 void importDisplaySettings(ConfFile& conf); 63 64 void setDisplayDefaults(); 65 }; 66 67 #endif 68