45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
#include "tft_handler.h"
|
|
|
|
void TFT_Handler::init(DISPLAY_STATE* display_state) {
|
|
_display_state = display_state;
|
|
|
|
tft.setColorDepth(16);
|
|
tft.init();
|
|
tft.fillScreen(0x0000);
|
|
}
|
|
|
|
void TFT_Handler::start_draw() {
|
|
tft.startWrite();
|
|
}
|
|
|
|
void TFT_Handler::end_draw() {
|
|
tft.endWrite();
|
|
}
|
|
|
|
void TFT_Handler::draw_box(int x, int y, int size_x, int size_y, int color) {
|
|
tft.setRotation(3);
|
|
tft.fillRect(x, y, size_x, size_y, color);
|
|
}
|
|
|
|
void TFT_Handler::draw_rect(int x, int y, int size_x, int size_y, int thickness, int color) {
|
|
tft.setRotation(3);
|
|
tft.drawRect(x, y, size_x, size_y, color);
|
|
}
|
|
|
|
void TFT_Handler::draw_line(int x1, int y1, int x2, int y2, int color) {
|
|
tft.drawLine(x1, y1, x2, y2, color);
|
|
}
|
|
|
|
void TFT_Handler::draw_text(int x, int y, std::string str) {
|
|
tft.setTextColor(TFT_WHITE);
|
|
tft.setTextSize(2);
|
|
tft.drawString(str.c_str(), x, y);
|
|
}
|
|
|
|
void TFT_Handler::fill_screen(int color) {
|
|
tft.fillScreen(color);
|
|
}
|
|
|
|
void TFT_Handler::draw_box_sprite(int x, int y, int size_x, int size_y, int color) {
|
|
|
|
} |