4 #include <drivers/fatfs/ff.h>
6 static uint8_t badge_framebuffer_render_char_with_fd(badge_framebuffer
*fb
, int8_t pos_x
, int8_t pos_y
, char c
, FIL
*fd
) {
8 uint8_t buffer
[BADGE_FONT_WIDTH
];
11 // intentionally left empty.
13 FR_OK
== f_lseek(fd
, (c
- 33) * BADGE_FONT_WIDTH
) &&
14 FR_OK
== f_read(fd
, buffer
, sizeof(buffer
), &readbytes
)) {
15 badge_sprite sp
= { BADGE_FONT_WIDTH
, BADGE_FONT_HEIGHT
, buffer
};
16 badge_framebuffer_blt(fb
, pos_x
, pos_y
, &sp
, 0);
24 uint8_t badge_framebuffer_render_char(badge_framebuffer
*fb
, int8_t pos_x
, int8_t pos_y
, char c
) {
27 if(FR_OK
== f_open(&fd
, "font.dat", FA_OPEN_EXISTING
| FA_READ
)) {
28 badge_framebuffer_render_char_with_fd(fb
, pos_x
, pos_y
, c
, &fd
);
36 uint8_t badge_framebuffer_render_text(badge_framebuffer
*fb
, int8_t pos_x
, int8_t pos_y
, char const *text
) {
40 if(FR_OK
== f_open(&fd
, "font.dat", FA_OPEN_EXISTING
| FA_READ
)) {
42 if(0 != badge_framebuffer_render_char_with_fd(fb
, pos_x
, pos_y
, *text
, &fd
)) {
48 pos_x
+= BADGE_FONT_WIDTH
;
This page took 0.047118 seconds and 5 git commands to generate.