summaryrefslogtreecommitdiff
path: root/examples/text.c
blob: 0982a3754c1183b2ba01c32be62a9927f0b395cf (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
26
27
28
#define FBGL_IMPLEMENTATION
#include "fbgl.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // for usleep
#include <stdint.h>

int main(int argc, char *argv[])
{
    fbgl_t buf;
    fbgl_init("/dev/fb0", &buf);

    fbgl_set_bg(&buf, 0x000000);

    fbgl_psf2_font_t *font = fbgl_load_psf2_font(argv[1]);

    size_t framerate = 30 * 30;
    fbgl_render_psf2_text(&buf, font, "hello fbgl", 100, 100, 0xFFFFFF);

    for(size_t i = 0; i < framerate; i++) {
	usleep(50000);
    }

    fbgl_destroy_psf2_font(font);
    fbgl_destroy(&buf);
    
    return 0;
}