-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsettingstask.h
54 lines (42 loc) · 1.24 KB
/
settingstask.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
#ifndef SETTINGSTASK_H
#define SETTINGSTASK_H
#include "task.h"
#include <vector>
#include <zlib.h>
class SettingsTask : public Task
{
public:
struct SettingsEntry {
const char *name;
const char **values; //If nullptr, the numeric value is used
unsigned int values_count;
unsigned int current_value;
unsigned int min_value; //Only makes sense if values == nullptr
unsigned int step;
};
enum Settings {
LEAVES = 0,
SPEED,
DISTANCE, //Managed by World, but can be changed here as well
FAST_MODE,
NEARPLANE_Z,
TICKS_ENABLED,
SHOW_FPS,
};
SettingsTask();
virtual ~SettingsTask();
virtual void makeCurrent() override;
virtual void render() override;
virtual void logic() override;
unsigned int getValue(unsigned int entry) const;
bool loadFromFile(gzFile file, int version);
bool saveToFile(gzFile file);
private:
std::vector<SettingsEntry> settings;
static constexpr int background_width = SCREEN_WIDTH - 50, background_height = SCREEN_HEIGHT - 50;
TEXTURE *background;
unsigned int current_selection = 0;
bool changed_something;
};
extern SettingsTask settings_task;
#endif // SETTINGSTASK_H