Go to file
mintsuki ef07a10cc3 Fix issue where ctx may have been accessed NULL in flanterm_fb_init() 2024-06-11 19:40:25 +02:00
backends Fix issue where ctx may have been accessed NULL in flanterm_fb_init() 2024-06-11 19:40:25 +02:00
.gitignore Add a gitignore 2024-05-28 00:25:10 +05:30
LICENSE Update copyright years 2024-01-02 19:18:32 +01:00
README.md Update README.md 2024-04-09 17:35:17 +02:00
flanterm.c Print replacement character for non-unicode characters as well 2024-04-07 05:55:01 +02:00
flanterm.h Drop support for (broken) 0x9b CSI 2024-04-07 05:20:01 +02:00

README.md

Flanterm

Flanterm is a fast and reasonably complete terminal emulator with support for multiple output backends. Included is a fast framebuffer backend.

Quick usage

To quickly set up and use a framebuffer Flanterm instance, it is possible to use the flanterm_fb_init() function as such:

#include <flanterm/flanterm.h>
#include <flanterm/backends/fb.h>

struct flanterm_context *ft_ctx = flanterm_fb_init(
        NULL,
        NULL,
        framebuffer_ptr, width, height, pitch,
        red_mask_size, red_mask_shift,
        green_mask_size, green_mask_shift,
        blue_mask_size, blue_mask_shift,
        NULL,
        NULL, NULL,
        NULL, NULL,
        NULL, NULL,
        NULL, 0, 0, 1,
        0, 0,
        0
    );

Where framebuffer_ptr, width, height, pitch and {red,green,blue}_mask_{size,shift} represent the corresponding info about the framebuffer to use for this given instance.

The meaning of the other arguments can be found in backends/fb.h.

To then print to the terminal instance, simply use the flanterm_write() function on the given instance. For example:

#include <flanterm/flanterm.h>

const char msg[] = "Hello world\n";

flanterm_write(ft_ctx, msg, sizeof(msg));