diff options
Diffstat (limited to 'examples/text.c')
| -rw-r--r-- | examples/text.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/text.c b/examples/text.c new file mode 100644 index 0000000..41e3560 --- /dev/null +++ b/examples/text.c @@ -0,0 +1,26 @@ +#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 fb; + fbgl_init("/dev/fb0", &fb); + + fbgl_set_bg(&fb, 0xFFFFFF); + + fbgl_psf1_font_t *font = fbgl_load_psf1_font(argv[1]); + fbgl_render_psf1_text(&fb, font, "hello, fbgl", 100, 100, 0x000000); + size_t framerate = 30 * 30; + + for(size_t i = 0; i < framerate; i++) { + usleep(50000); + } + fbgl_destroy_psf1_font(font); + fbgl_destroy(&fb); + + return 0; +} |
