aboutsummaryrefslogtreecommitdiff
path: root/src/text.c
blob: 9946c74279e42606d762220019c6385dc6cc8c36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdint.h>

#include "ubox_vga.h"
#include "ubox_text.h"

static const uint8_t *font;
static uint8_t w, h;

void ubox_set_font(const uint8_t *pixdata, uint8_t width, uint8_t height)
{
    font = pixdata;
    w = width;
    h = height;
}

void ubox_put_text(uint16_t x, uint16_t y, const char *text, uint8_t color)
{
    ubox_rect dst = { x, y, w, h};

    while (*text)
    {
        ubox_blit_c(font + ((*text++ - ' ') * w * h), &dst, color);
        dst.x += w;
    }
}