-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmart.h
More file actions
66 lines (56 loc) · 1.8 KB
/
Smart.h
File metadata and controls
66 lines (56 loc) · 1.8 KB
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
/*
This file is part of Smart.
Smart is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
Smart is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with Smart. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SMART_H
#define SMART_H
#include "settings.h"
#include <Watchy.h>
// This must be a signed type as coordinates may be negative
#define multiline_t int8_t
// Describes a box we can put text in, and an "exclusion zone": If any
// watch hand is inside this exclusion zone, the box is considered
// "covered" and thus not usable.
typedef struct {
const char *name;
struct {
int16_t x;
int16_t y;
} topleft;
struct {
int16_t x;
int16_t y;
} botright;
// The range of angles for the exclusion zone.
// If min > max, this means that the area includes the 0° angle
// These angles must be normalised - i.e. in the range of [0..359]
struct {
float min;
float max;
} exclude_angles;
} Box;
class Smart : public Watchy{
using Watchy::Watchy;
public:
void drawWatchFace();
protected:
void drawMultiLine(const multiline_t *line , uint numPoints, float angle);
void drawHourHand();
void drawMinuteHand();
void drawDayOfWeek(const Box *box);
void drawDate(const Box *box);
void drawText(const char *text, const GFXfont *font, const Box *box);
uint usableBoxes(uint boxes_wanted, const Box **boxes);
float hourHandAngle;
float minuteHandAngle;
};
#endif