-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClock.h
More file actions
73 lines (57 loc) · 1.54 KB
/
Clock.h
File metadata and controls
73 lines (57 loc) · 1.54 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
67
68
69
70
71
72
73
#pragma once
#include "App.h"
#include "MyPrint.h"
#define ROW_SPACE 10
#define NUM_ROWS 3
#define X_SPACE 10
class Kernel;
enum Selection {
STOPWATCH = ROW_SPACE,
TIMER = 2 * ROW_SPACE,
ALARMS = 3 * ROW_SPACE,
};
Selection operator++(Selection& s);
Selection operator--(Selection& s);
enum TimeSelection {
NOT_EDITING = 1,
HOUR = 40,
MINUTE = HOUR + 3 * CHAR_SPACE_W, //=58,
SECOND = MINUTE + 3 * CHAR_SPACE_W //=76,
};
TimeSelection operator++(TimeSelection& s);
TimeSelection operator--(TimeSelection& s);
enum AlarmEdit {
ID = 1, SET,
HOUR_, MINUTE_,
SUNDAY = 5, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY=11,
NOT
};
AlarmEdit operator++(AlarmEdit& s);
AlarmEdit operator--(AlarmEdit& s);
short getX(AlarmEdit a);
short getY(AlarmEdit a);
short getWidth(AlarmEdit a);
class Clock : public App {
bool just_moved_x = false;
bool just_moved_y = false;
Selection current_selection = Selection::STOPWATCH;
void _clearStopwatchArea();
void _clearTimerArea();
void _underline(short x, short y, short num_chars, bool clear = true);
void _clearAlarmArea();
void _setup_sprites();
//void _drawDOW(
TimeSelection edit = TimeSelection::NOT_EDITING;
AlarmEdit alarm_edit = NOT;
int alarm_number = 0;
TFT_eSprite* stopwatch = nullptr;
TFT_eSprite* timer = nullptr;
Kernel* kernel;
public:
Clock(Kernel* kernel);
~Clock();
void run_code(double x, double y, bool special);
void update_selection(double x, double y);
String get_name();
void checkSpecial(double x, double y, bool special);
};