1 #ifndef INC_SETTINGS_H
2 #define INC_SETTINGS_H
3 
4 #include <vector>
5 #include <string>
6 using namespace std;
7 
8 #include "keybindings.h"
9 
10 #include <SDL/SDL.h>
11 
12 enum UseAALevel
13 {
14     AA_NO,
15     AA_YES,
16     AA_FORCE
17 };
18 
19 enum BGType
20 {
21     BG_FIRST = 0,
22     BG_NONE = 0,
23     BG_STARS = 1,
24     BG_SOLAR = 2,
25     BG_LAST = 2
26 };
27 
28 extern string bgTypeStrings[];
29 
30 struct Settings
31 {
32     bool debug;
33     bool wizard;
34     bool invuln;
35     UseAALevel useAA;
36     bool showGrid;
37     bool zoomEnabled;
38     bool rotatingView;
39     float turnRateFactor;
40     float requestedRating;
41     int speed;
42     bool stopMotion;
43 
44     Keybindings keybindings;
45     command commandToBind;
46 
47     BGType bgType;
48 
49     int fps;
50     bool showFPS;
51 
52     int width;
53     int height;
54     int bpp;
55     bool fullscreen;
56     Uint32 videoFlags;
57 
58     bool sound;
59     float volume;
60     int soundFreq;
61 
62     int clockRate;
63 
64     Settings();
65 };
66 
67 int rateOfSpeed(int speed);
68 const char* speedString(int speed);
69 const char* speedStringShort(int speed);
70 
71 extern Settings settings;
72 
73 // Rect: convenience wrapper around SDL_Rect
74 struct Rect
75 {
76     int w;
77     int h;
78 
79     static int cmp(const Rect& r1, const Rect& r2);
80 
wRect81     Rect(int w=0, int h=0) : w(w), h(h) {}
RectRect82     Rect(SDL_Rect r) : w(r.w), h(r.h) {}
83 };
84 
85 // getSDLModes: convenience wrapper around SDL_ListModes
86 vector<Rect> getSDLModes();
87 
88 #ifndef __APPLE__
89 void load_settings(int argc, char** argv);
90 #endif
91 
92 #endif /* INC_SETTINGS_H */
93