PocketPutr/Desktop_Test/tft_handler.cpp
2025-12-14 13:00:01 +01:00

49 lines
996 B
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::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();
}