-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXUI_ScreenFonts.cpp
More file actions
52 lines (42 loc) · 1.22 KB
/
XUI_ScreenFonts.cpp
File metadata and controls
52 lines (42 loc) · 1.22 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
#include "XUI_Engine.h"
#include "XUI_ScreenFonts.h"
XUI_ScreenFonts::XUI_ScreenFonts(string title)
: XUI_Screen(title)
{
_draw = true;
}
void XUI_ScreenFonts::run(){
if (_draw){ // avoid drawing when nothing has changed
xuiDisplay->clear();
xuiDisplay->drawText(fontNames[currentIndex], 0, 5, fonts[currentIndex]);
xuiDisplay->drawText("Un anillo para gobernarlos a todos", 1, 5, fonts[currentIndex]);
xuiDisplay->drawText("un anillo para encontrarlos. 123456789", 2, 5, fonts[currentIndex]);
xuiDisplay->drawText("un anillo para traerlos a todos", 3, 5, fonts[currentIndex]);
xuiDisplay->drawText("y atarlos en la oscuridad. 123456789", 4, 5, fonts[currentIndex]);
xuiDisplay->display();
_draw = false;
}
}
void XUI_ScreenFonts::bttn_event(uint8_t button){
_draw = true;
switch (button){
case BTTN_UP:
if (currentIndex == 0){
currentIndex = FONT_COUNT-1;
}else{
currentIndex--;
}
_draw = true;
break;
case BTTN_DOWN:
currentIndex++;
if (currentIndex > FONT_COUNT-1) currentIndex = 0;
_draw = true;
break;
case BTTN_LEFT:
xuiEngine->nav(prevScreen);
break;
case BTTN_RIGHT:
break;
}
}