Files
ESP8266lib/ext/lcd/ui/UIPainter.h
2020-07-04 15:53:15 +02:00

59 lines
1.2 KiB
C++

#ifndef UI_PAINTER_H
#define UI_PAINTER_H
#include "../../../Debug.h"
#include "../Draw.h"
#include "UIStructs.h"
#include <string>
class Setter;
class FontWrap;
extern const FontWrap fnt_f1;
extern Setter setter;
class UIPainter {
public:
void drawLine(const uint16_t x1, const uint16_t y1, const uint16_t x2, const uint16_t y2) {
debugMod("UI", "draw line");
drawer.drawLine(x1,y1, x2,y2);
}
void drawLineHor(const uint16_t x1, const uint16_t x2, const uint16_t y) {
drawer.drawLineHor(x1,x2,y);
}
void drawLineVer(const uint16_t y1, const uint16_t y2, const uint16_t x) {
drawer.drawLineVer(y1,y2,x);
}
void drawRect(UIRect r) {
drawer.drawRect(r.x, r.y, r.w, r.h);
}
void drawText(const uint16_t x, const uint16_t y, const char* str) {
fnt_f1.draw(str, x, y, setter);
}
void drawText(const uint16_t x, const uint16_t y, const std::string& str) {
drawText(x, y, str.c_str());
}
void setFG(const Color fg) {
drawer.setColor(fg);
}
void fillRect(const UIRect rect) {
drawer.fillRect(rect.x, rect.y, rect.w, rect.h);
}
void fillRect(const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h) {
drawer.fillRect(x,y,w,h);
}
};
#endif // UI_PAINTER_H