#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::draw_box(int x, int y, int size_x, int size_y, int color) { tft.startWrite(); tft.setRotation(3); tft.fillRect(x, y, size_x, size_y, color); tft.endWrite(); } void TFT_Handler::draw_rect(int x, int y, int size_x, int size_y, int thickness, int color) { tft.startWrite(); tft.setRotation(3); tft.drawRect(x, y, size_x, size_y, color); tft.endWrite(); } 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.startWrite(); tft.setTextColor(TFT_WHITE); tft.setTextSize(2); tft.drawString(str.c_str(), x, y); tft.endWrite(); } void TFT_Handler::fill_screen(int color) { tft.startWrite(); tft.fillScreen(color); tft.endWrite(); }