-
Notifications
You must be signed in to change notification settings - Fork 0
/
GFX.cpp
74 lines (55 loc) · 1.19 KB
/
GFX.cpp
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
#include "GFX.h"
void GFX::HorizontalSwipe() {
FOR_x {
Display::DrawLine(x, 0, x, LCD_HEIGHT - 1, BLACK);
if (x >= 1) {
uint16_t x2 = x - 1;
Display::DrawLine(x2, 0, x2, LCD_HEIGHT - 1, WHITE);
}
if (x > 1) {
FOR_y {
uint16_t x2 = x - 2;
PIXEL_MAP(x2, y);
}
}
Display::UpdateFromDisplay();
}
for (uint8_t x = LCD_WIDTH - 2; x < LCD_WIDTH; x++) {
FOR_y {
PIXEL_MAP(x, y);
}
Display::UpdateFromDisplay();
}
}
void GFX::VerticalSwipe() {
FOR_y {
Display::DrawLine(0, y, LCD_WIDTH - 1, y, BLACK);
if (y >= 1) {
uint16_t y2 = y - 1;
Display::DrawLine(0, y2, LCD_WIDTH - 1, y2, WHITE);
}
if (y > 1) {
FOR_x {
uint16_t y2 = y - 2;
PIXEL_MAP(x, y2);
}
}
Display::UpdateFromDisplay();
}
for (uint8_t y = LCD_HEIGHT - 2; y < LCD_HEIGHT; y++) {
FOR_x {
PIXEL_MAP(x, y);
}
Display::UpdateFromDisplay();
}
}
void GFX::RandomSwipe() {
if (random(256) < 128) {
GFX::HorizontalSwipe();
} else {
GFX::VerticalSwipe();
}
}
void GFX::Message(uint8_t x, uint8_t y, String &text) {
Display::DrawText(x, y, text);
}