-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.h
89 lines (82 loc) · 1.91 KB
/
Config.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
// Matrix configuration parsing class declaration.
// Author: Tony DiCola
#ifndef CONFIG_H
#define CONFIG_H
#include <string>
#include <vector>
#include "GridTransformer.h"
class Config {
public:
Config(const std::string& filename);
~Config();
// Attribute accessors:
float getAnimationDuration(int set_index) const {
return _animation_durations[set_index];
}
int getDisplayWidth() const {
return _display_width;
}
int getDisplayHeight() const {
return _display_height;
}
int getLEDCutoff() const {
return _led_cutoff;
}
int getLEDMaxBrightness() const {
return _led_max_brightness;
}
int getPanelWidth() const {
return _panel_width;
}
int getPanelHeight() const {
return _panel_height;
}
int getChainLength() const {
return _chain_length;
}
const char* getImage(int set_index, int image_index)
{
return (*_image_sets[set_index])[image_index].c_str();
}
int getImageCount(int index) const {
return _image_sets[index]->size();
}
int getImageSetCount() const {
return _image_sets.size();
}
int getImageSetDuration() const {
return _image_set_duration;
}
int getParallelCount() const {
return _parallel_count;
}
GridTransformer* getGridTransformer() const
{
return new GridTransformer(_display_width, _display_height, _panel_width, _panel_height, _chain_length, _panels);
}
bool hasCropOrigin() const {
return (_crop_x > -1) && (_crop_y > -1);
}
int getCropX() const {
return _crop_x;
}
int getCropY() const {
return _crop_y;
}
private:
int _display_width,
_display_height,
_panel_width,
_panel_height,
_chain_length,
_parallel_count,
_crop_x,
_crop_y;
int _led_cutoff,
_led_max_brightness;
int _image_set_duration;
std::vector<float> _animation_durations;
std::vector<GridTransformer::Panel> _panels;
std::vector<std::vector<std::string>*> _image_sets;
};
#endif