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/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, NULL,
22 NULL, NULL,
23 NULL, NULL,
24 NULL, 0, 0, 1,
25 0, 0,
26 0
27 );
28```
29Where `framebuffer_ptr, width, height, pitch` and `{red,green,blue}_mask_{size,shift}`
30represent the corresponding info about the framebuffer to use for this given instance.
31
32The meaning of the other arguments can be found in `backends/fb.h`.
33
34To then print to the terminal instance, simply use the `flanterm_write()`
35function on the given instance. For example:
36```c
37#include <flanterm/flanterm.h>
38
39const char msg[] = "Hello world\n";
40
41flanterm_write(ft_ctx, msg, sizeof(msg));
42```