Added font support
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "tft.h"
|
||||
#include "ll_tft.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//it might seems pointless to forward all the functions but we might also introduce functions which have some logic here
|
||||
|
||||
@@ -37,3 +39,24 @@ void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t h
|
||||
void tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color) {
|
||||
ll_tft_draw_circle(x, y, r, color);
|
||||
}
|
||||
|
||||
uint8_t tft_num_fonts() {
|
||||
return ll_tft_num_fonts();
|
||||
}
|
||||
|
||||
uint8_t tft_font_height(uint8_t fontnum) {
|
||||
return ll_tft_font_height(fontnum);
|
||||
}
|
||||
|
||||
uint8_t tft_font_width(uint8_t fontnum) {
|
||||
return ll_tft_font_width(fontnum);
|
||||
}
|
||||
|
||||
void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char* text) {
|
||||
if(font>=ll_tft_num_fonts()) return;
|
||||
for(int i=0; i<strlen(text); i++) {
|
||||
ll_tft_draw_char(x,y,color,bgcolor, font, text[i]);
|
||||
x+=ll_tft_font_width(font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user