OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Options.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_OPTIONS_H
20 #define OPENXCOM_OPTIONS_H
21 
22 #include <SDL.h>
23 #include <string>
24 #include <vector>
25 #include "OptionInfo.h"
26 
27 namespace OpenXcom
28 {
29 
31 enum ScrollType { SCROLL_NONE, SCROLL_TRIGGER, SCROLL_AUTO };
33 enum KeyboardType { KEYBOARD_OFF, KEYBOARD_ON, KEYBOARD_VIRTUAL };
35 enum SaveSort { SORT_NAME_ASC, SORT_NAME_DESC, SORT_DATE_ASC, SORT_DATE_DESC };
37 enum MusicFormat { MUSIC_AUTO, MUSIC_FLAC, MUSIC_OGG, MUSIC_MP3, MUSIC_MOD, MUSIC_WAV, MUSIC_ADLIB, MUSIC_MIDI };
39 enum SoundFormat { SOUND_AUTO, SOUND_14, SOUND_10 };
42  PATH_NONE = 0x00, // 0000 (must always be zero)
43  PATH_ARROWS = 0x01, // 0001
44  PATH_TU_COST = 0x02, // 0010
45  PATH_FULL = 0x03 // 0011 (must always be all values combined)
46 };
47 
48 enum ScaleType
49 {
50  SCALE_ORIGINAL,
51  SCALE_15X,
52  SCALE_2X,
53  SCALE_SCREEN_DIV_3,
54  SCALE_SCREEN_DIV_2,
55  SCALE_SCREEN
56 };
61 namespace Options
62 {
63 #define OPT extern
64 #include "Options.inc.h"
65 #undef OPT
66 
68  void create();
70  void resetDefault();
72  bool init(int argc, char *argv[]);
74  void load(const std::string &filename = "options");
76  void save(const std::string &filename = "options");
78  std::string getDataFolder();
80  void setDataFolder(const std::string &folder);
82  const std::vector<std::string> &getDataList();
84  std::string getUserFolder();
86  std::string getConfigFolder();
88  const std::vector<OptionInfo> &getOptionInfo();
90  void setFolders();
92  void updateOptions();
94  void backupDisplay();
96  void switchDisplay();
97 }
98 
99 }
100 
101 #endif
void updateOptions()
Updates the game's options with those in the configuation file, if it exists yet, and any supplied on...
Definition: Options.cpp:469
MusicFormat
Music format preferences.
Definition: Options.h:37
void switchDisplay()
Switches old/new display options for temporarily testing a new display setup.
Definition: Options.cpp:634
const std::vector< std::string > & getDataList()
Returns the game's list of possible Data folders.
Definition: Options.cpp:579
void setDataFolder(const std::string &folder)
Changes the game's current Data folder where resources and X-Com files are loaded from...
Definition: Options.cpp:570
void create()
Sets up the options by creating their OptionInfo metadata.
Definition: Options.cpp:57
PathPreview
Path preview modes (can be OR'd together).
Definition: Options.h:41
std::string getUserFolder()
Returns the game's User folder where saves are stored in.
Definition: Options.cpp:589
bool init(int argc, char *argv[])
Handles the initialization of setting up default options and finding and loading any existing ones...
Definition: Options.cpp:386
SoundFormat
Sound format preferences.
Definition: Options.h:39
std::string getConfigFolder()
Returns the game's Config folder where settings are stored in.
Definition: Options.cpp:600
ScrollType
Battlescape drag scrolling types.
Definition: Options.h:31
std::string getDataFolder()
Returns the game's current Data folder where resources and X-Com files are loaded from...
Definition: Options.cpp:560
void save(const std::string &filename)
Saves options to a YAML file.
Definition: Options.cpp:530
void resetDefault()
Resets the options back to their defaults.
Definition: Options.cpp:276
const std::vector< OptionInfo > & getOptionInfo()
Returns the game's list of all available option information.
Definition: Options.cpp:609
KeyboardType
Keyboard input modes.
Definition: Options.h:33
SaveSort
Savegame sorting modes.
Definition: Options.h:35
void setFolders()
Sets up the game's Data folder where the data files are loaded from and the User folder and Config fo...
Definition: Options.cpp:423
void load(const std::string &filename)
Loads options from a YAML file.
Definition: Options.cpp:502
void backupDisplay()
Saves display settings temporarily to be able to revert to old ones.
Definition: Options.cpp:618