Fast and reasonably complete (framebuffer) terminal emulator (Zig fork)
1# Flanterm
2
3Flanterm is a fast and reasonably complete terminal emulator with support for
4multiple output backends. Included is a fast framebuffer backend.
5
6### Quick usage
7
8To quickly set up and use a framebuffer Flanterm instance, it is possible to
9use the `flanterm_fb_init()` function as such:
10```c
11#include <flanterm.h>
12#include <flanterm_backends/fb.h>
13
14struct flanterm_context *ft_ctx = flanterm_fb_init(
15 NULL,
16 NULL,
17 framebuffer_ptr, width, height, pitch,
18 red_mask_size, red_mask_shift,
19 green_mask_size, green_mask_shift,
20 blue_mask_size, blue_mask_shift,
21 NULL,
22 NULL, NULL,
23 NULL, NULL,
24 NULL, NULL,
25 NULL, 0, 0, 1,
26 0, 0,
27 0
28 );
29```
30Where `framebuffer_ptr, width, height, pitch` and `{red,green,blue}_mask_{size,shift}`
31represent the corresponding info about the framebuffer to use for this given instance.
32
33The meaning of the other arguments can be found in `flanterm_backends/fb.h`.
34
35To then print to the terminal instance, simply use the `flanterm_write()`
36function on the given instance. For example:
37```c
38#include <flanterm.h>
39
40const char msg[] = "Hello world\n";
41
42flanterm_write(ft_ctx, msg, sizeof(msg));
43```