many updates..
new sensors.. display.. led.. drawing.. stuff..
This commit is contained in:
45
ext/lcd/ui/UILabel.h
Normal file
45
ext/lcd/ui/UILabel.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef UI_LABEL_H
|
||||
#define UI_LABEL_H
|
||||
|
||||
#include "UIElement.h"
|
||||
#include "UIStructs.h"
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
#include <string>
|
||||
|
||||
class UILabel : public UIElement {
|
||||
|
||||
std::string txt;
|
||||
|
||||
Color cBackground = Color::fromRGB(255,255,255);
|
||||
Color cText = Color::fromRGB(0,0,0);
|
||||
|
||||
public:
|
||||
|
||||
UILabel() {
|
||||
;
|
||||
}
|
||||
|
||||
void setText(const std::string& txt) {
|
||||
this->txt = txt;
|
||||
setNeedsRedraw();
|
||||
}
|
||||
|
||||
void draw(UIPainter& p) {
|
||||
|
||||
p.setFG(cBackground);
|
||||
p.fillRect(rect);
|
||||
|
||||
//const uint16_t txtW = fnt_f1.getWidth(txt);
|
||||
//const uint16_t txtH = fnt_f1.getHeight();
|
||||
|
||||
p.setFG(cText);
|
||||
p.drawText(rect.x, rect.y, txt.c_str());
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // UI_LABEL_H
|
||||
Reference in New Issue
Block a user