worked on SPI, fixed some bugs
adjusted LCD code added code for INA3221 worked on UI
This commit is contained in:
@@ -44,15 +44,16 @@ class UI {
|
||||
UIPainter p;
|
||||
UIElement root;
|
||||
|
||||
UIElement* eFocused = nullptr;
|
||||
int focusIdx = 0;
|
||||
//UIElement* eFocused = nullptr;
|
||||
UIElement* eDown = nullptr;
|
||||
|
||||
Color cBackground = Color::fromRGB(180,240,180);
|
||||
|
||||
public:
|
||||
|
||||
UI() {
|
||||
root.setRect(0,0,240,320);
|
||||
UI(int w, int h) {
|
||||
root.setRect(0,0,w,h);
|
||||
root.setVisible(true);
|
||||
p.setFG(cBackground);
|
||||
p.fillRect(root.getRect());
|
||||
@@ -77,7 +78,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void onTouchDone() {
|
||||
@@ -87,13 +87,28 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void focusNext() {
|
||||
root.children[focusIdx]->setFocus(false);
|
||||
focusIdx = (focusIdx + 1) % root.children.size();
|
||||
root.children[focusIdx]->setFocus(true);
|
||||
}
|
||||
void focusPrev() {
|
||||
root.children[focusIdx]->setFocus(false);
|
||||
focusIdx = ((focusIdx - 1) + root.children.size()) % root.children.size();
|
||||
root.children[focusIdx]->setFocus(true);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
//debugMod1("UI", "draw %zu elements", elements.size());
|
||||
// for (UIElement* e : elements) {
|
||||
// e->_draw(p);
|
||||
// }
|
||||
|
||||
//p.setFG(cBackground);
|
||||
//p.fillRect(root.getRect());
|
||||
|
||||
root._draw(p);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user