-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathConfig.h
68 lines (62 loc) · 1.62 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
// -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
// Matrix configuration parsing class declaration.
// Author: Tony DiCola
#ifndef CONFIG_H
#define CONFIG_H
#include <string>
#include <vector>
#include "GridTransformer.h"
#include "led-matrix.h"
class Config {
public:
Config(rgb_matrix::RGBMatrix::Options *options,
const std::string& filename);
// Attribute accessors:
int getDisplayWidth() const {
return (_display_width < 0)
? getPanelWidth() * getChainLength()
: _display_width;
}
int getDisplayHeight() const {
return (_display_height < 0)
? getPanelHeight() * getParallelCount()
: _display_height;
}
int getPanelWidth() const {
return (_panel_width) < 0 ? 32 : _panel_width;
}
int getPanelHeight() const {
return _moptions->rows;
}
int getChainLength() const {
return _chain_length;
}
int getParallelCount() const {
return _moptions->parallel;
}
bool hasTransformer() const { return !_panels.empty(); }
GridTransformer getGridTransformer() const {
return GridTransformer(getDisplayWidth(), getDisplayHeight(),
getPanelWidth(), getPanelHeight(),
getChainLength(), _panels);
}
bool hasCropOrigin() const {
return (_crop_x > -1) && (_crop_y > -1);
}
int getCropX() const {
return _crop_x;
}
int getCropY() const {
return _crop_y;
}
private:
rgb_matrix::RGBMatrix::Options* const _moptions;
int _display_width,
_display_height,
_panel_width,
_chain_length,
_crop_x,
_crop_y;
std::vector<GridTransformer::Panel> _panels;
};
#endif