-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.cpp
83 lines (73 loc) · 1.69 KB
/
Menu.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
75
76
77
78
79
80
81
82
83
#include "Menu.h"
Menu::Menu(){
menu[0]="Time to update screen [250]";
menu[1]="---";
menu[2]="---";
menu[3]="---";
menu[4]="Sound [ON|OFF]";
menu[5]="---";
menu[6]="---";
menu[7]="---";
menu[8]="---";
menu[9]="---";
menu[10]="---";
menu[11]="---";
menu[12]="---";
menu[13]="---";
menu[14]="---";
menu[15]="Exit";
}
void Menu::show(){
boolean exitMenu=false;
boolean pressed=false;
draw();
while(!exitMenu){
// if(GO.BtnA.isPressed() || GO.BtnB.isPressed() || GO.BtnMenu.isPressed()
// || GO.BtnVolume.isPressed() || GO.BtnSelect.isPressed() ||
// GO.BtnStart.isPressed()) {pressed=true;}
//
if (GO.JOY_Y.wasAxisPressed() == 2) {
currentItem++;
pressed=true;
}
if (GO.JOY_Y.wasAxisPressed() == 1) {
currentItem--;
pressed=true;
}
if (currentItem>MENU_SIZE){ currentItem=0;}
if (currentItem<0){ currentItem=MENU_SIZE;}
// if (GO.BtnMenu.wasPressed()) {
// exitMenu=true;
// }
//
if (GO.BtnA.wasPressed()) {
if (menu[currentItem]=="Exit"){
exitMenu=true;
}
}
if (pressed==true){
draw();
}
// if (GO.JOY_X.wasAxisPressed() == 2) {
// left;
// }
// if (GO.JOY_X.wasAxisPressed() == 1) {
// right;
// }
delay(250);
}
}
void Menu::draw(){
GO.lcd.setTextSize(1);
GO.lcd.clearDisplay();
GO.lcd.drawString(" ---== Menu ==--- ",0,0);
for(int i=0;i<MENU_SIZE;i++){
if (currentItem==i){
GO.lcd.setTextColor(LIGHTGREY);
} else{
GO.lcd.setTextColor(DARKGREY);
}
GO.lcd.drawString(menu[i],0,((i+1)*10)+1);
}
GO.lcd.drawString(" 0<-- 0 -->0",0,231);
}