#include "GLOBALS.h" #include "tft_handler.h" void TFT_Handler::init(DISPLAY_STATE* display_state) { _display_state = display_state; tft.setColorDepth(16); tft.init(); tft.setRotation(3); tft.fillScreen(0x0000); sprite.setColorDepth(16); sprite.setPsram(true); sprite.createSprite(480, 320); } void TFT_Handler::draw_box(short int x, short int y, short int size_x, short int size_y, int color) { sprite.fillRect(x, y, size_x, size_y, color); } void TFT_Handler::draw_rect(short int x, short int y, short int size_x, short int size_y, short int thickness, int color) { sprite.drawRect(x, y, size_x, size_y, color); } void TFT_Handler::draw_line(short int x1, short int y1, short int x2, short int y2, int color) { sprite.drawLine(x1, y1, x2, y2, color); } void TFT_Handler::draw_text(short int x, short int y, const std::string& str, int color, short int size) { sprite.setTextColor(color); sprite.setTextSize(size); sprite.drawString(str.c_str(), x, y); } void TFT_Handler::fill_screen(int color) { sprite.fillScreen(color); } void TFT_Handler::push_sprite() { sprite.pushSprite(0, 0); }