-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.h
130 lines (115 loc) · 2.79 KB
/
configuration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
// files
#define CONFIG_DAT "config.dat"
#define SCORES_DAT "scores.dat"
// set_default member values
#define DEFAULT_DISPLAY 1
#define DEFAULT_AUDIO 2
#define DEFAULT_INPUT 3
#define DEFAULT_GENERAL 4
#define DEFAULT_HISCORES 5
#define DEFAULT_ALL 0
// Display
#define SM_640X480 0
#define SM_800X600 1
#define SM_1024X768 2
#include <SDL/SDL.h>
/** TreeView of config.dat structure
Config.dat
|
+-- Display
| |
| +-- resolution (int)
| +-- fullscreen (int)
| +-- depth (int)
| +-- hwsurface (int)
| +-- doublebuf (int)
|
+-- Audio
| |
| +-- enabled (int)
| +-- music (int)
| +-- soundfx (int)
| +-- path (char[15])
|
+-- Input
| |
| +-- jostick (int)
| +-- repeat_delay (int)
| +-- repeat_interval (int)
| +-- k_left_ (SDLKey)
| +-- k_left_ (SDLKey)
| +-- k_right_ (SDLKey)
| +-- k_rotate_ (SDLKey)
| +-- k_down_ (SDLKey)
| +-- k_down_all_ (SDLKey)
| +-- k_pause_ (SDLKey)
|
+-- Game
| |
| +-- o_speed
| +-- x_speed
| +-- lines_per_level
| +-- h_board_size
| +-- w_board_size
| +-- game_mode
|
+-- General
|
+-- theme_path (char[15])
scores.dat
|
+-- HiScores
+-- winner[10] (char[15])
+-- score (unsigned)
+-- lines (unsigned)
+-- level (unsigned)
+-- ttime (unsigned)
**/
using namespace std;
class Configuration
{
public:
Configuration();
~Configuration();
int save_configuration(void);
void set_default(Uint8 what_default);
struct {
Uint8 resolution;
Uint8 fullscreen;
Uint8 depth;
Uint8 hwsurface;
Uint8 doublebuf;
} display;
struct {
Uint8 enabled;
Uint8 music;
Uint8 soundfx;
//Uint8 path[15];
} audio;
struct {
Uint8 jostick;
Uint16 repeat_delay;
Uint16 repeat_interval;
SDLKey k_left_;
SDLKey k_right_;
SDLKey k_rotate_;
SDLKey k_down_;
SDLKey k_down_all_;
SDLKey k_pause_;
} input;
struct {
//string theme_path;
} general;
struct hi_scores {
//string name;
Uint32 score;
Uint32 lines;
Uint32 level;
Uint32 ttime;
} hiscores[15];
private:
int load_configuration(void);
};
#endif