1 /*
2 Copyright © 2016 Justin Jacobs
3 
4 This file is part of FLARE.
5 
6 FLARE is free software: you can redistribute it and/or modify it under the terms
7 of the GNU General Public License as published by the Free Software Foundation,
8 either version 3 of the License, or (at your option) any later version.
9 
10 FLARE is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along with
15 FLARE.  If not, see http://www.gnu.org/licenses/
16 */
17 
18 #ifndef PLATFORM_H
19 #define PLATFORM_H
20 
21 #include <string>
22 
23 class Platform {
24 public:
25 	enum {
26 		CONFIG_MENU_TYPE_BASE = 0,
27 		CONFIG_MENU_TYPE_DESKTOP = 1,
28 		CONFIG_MENU_TYPE_DESKTOP_NO_VIDEO = 2
29 	};
30 
31 	class Video {
32 	public:
33 		static const int COUNT = 11;
34 		enum {
35 			RENDERER,
36 			FULLSCREEN,
37 			HWSURFACE,
38 			VSYNC,
39 			TEXTURE_FILTER,
40 			DPI_SCALING,
41 			PARALLAX_LAYERS,
42 			ENABLE_GAMMA,
43 			GAMMA,
44 			MAX_RENDER_SIZE,
45 			FRAME_LIMIT,
46 		};
47 	};
48 
49 	class Audio {
50 	public:
51 		static const int COUNT = 2;
52 		enum {
53 			SFX,
54 			MUSIC
55 		};
56 	};
57 
58 	class Interface {
59 	public:
60 		static const int COUNT = 16;
61 		enum {
62 			LANGUAGE,
63 			SUBTITLES,
64 			COLORBLIND,
65 			MINIMAP_MODE,
66 			LOOT_TOOLTIPS,
67 			AUTO_EQUIP,
68 			ITEM_COMPARE_TIPS,
69 			LOW_HP_WARNING_TYPE,
70 			LOW_HP_THRESHOLD,
71 			COMBAT_TEXT,
72 			STATBAR_LABELS,
73 			STATBAR_AUTOHIDE,
74 			HARDWARE_CURSOR,
75 			ENTITY_MARKERS,
76 			SHOW_FPS,
77 			DEV_MODE
78 		};
79 	};
80 
81 	class Input {
82 	public:
83 		static const int COUNT = 9;
84 		enum {
85 			MOUSE_MOVE,
86 			MOUSE_MOVE_SWAP,
87 			MOUSE_MOVE_ATTACK,
88 			MOUSE_AIM,
89 			NO_MOUSE,
90 			JOYSTICK,
91 			JOYSTICK_DEADZONE,
92 			TOUCH_CONTROLS,
93 			TOUCH_SCALE
94 		};
95 	};
96 
97 	class Misc {
98 	public:
99 		static const int COUNT = 2;
100 		enum {
101 			KEYBINDS,
102 			MODS
103 		};
104 	};
105 
106 	Platform();
107 	~Platform();
108 
109 	void setPaths();
110 	void setExitEventFilter();
111 	bool dirCreate(const std::string& path);
112 	bool dirRemove(const std::string& path);
113 
114 	void FSInit();
115 	bool FSCheckReady();
116 	void FSCommit();
117 
118 	void setScreenSize();
119 	void setFullscreen(bool enable);
120 
121 	bool has_exit_button;
122 	bool is_mobile_device;
123 	bool force_hardware_cursor;
124 	bool has_lock_file;
125 	bool needs_alt_escape_key;
126 	bool fullscreen_bypass;
127 	unsigned char config_menu_type;
128 	std::string default_renderer;
129 
130 	std::vector<bool> config_video;
131 	std::vector<bool> config_audio;
132 	std::vector<bool> config_interface;
133 	std::vector<bool> config_input;
134 	std::vector<bool> config_misc;
135 };
136 
137 extern Platform platform;
138 
139 #endif
140