diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-06-21 13:51:24 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-06-21 13:51:24 +0300 |
| commit | 3fed5969034c464e36358fc45a99b57b1f308c11 (patch) | |
| tree | 874dfffb1612d63b03b0198d229f16fe52b96d6f /framebuffer.h | |
| parent | 8e4a57e034d98777fc58ff90c542c96f18f0e575 (diff) | |
| download | wafflestone-3fed5969034c464e36358fc45a99b57b1f308c11.tar.xz | |
term_init() and term_cleanup(), mostly
Diffstat (limited to 'framebuffer.h')
| -rw-r--r-- | framebuffer.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/framebuffer.h b/framebuffer.h index 1b0254f..373cfb4 100644 --- a/framebuffer.h +++ b/framebuffer.h @@ -5,8 +5,9 @@ #include <stddef.h> /* wchar_t */ #include <sys/types.h> /* ssize_t */ -/* Globals for the terminal size, set by fb_init() */ -extern size_t TERM_WIDTH, TERM_HEIGHT; +/* Globals for the terminal size, set by term_update_size() */ +extern size_t term_width, term_height; +extern struct termios initial_terminal_state; /* Represents a 24 bit colour, 8 bit per channel */ typedef struct Colour_s { @@ -60,12 +61,18 @@ void fb_fill(Framebuffer fb, Pixel pixel); void inline fb_put(Framebuffer fb, size_t row, size_t col, Pixel pixel); /* Initializes the terminal and sets TERM_WIDTH and TERM_HEIGHT */ -void fb_init(void); +void term_init(void); /* Undoes everything fb_init() did */ -void fb_cleanup(void); +void term_cleanup(void); + +/* Updates term_width and term_height */ +void term_update_size(void); /* Prints fb to the screen */ void fb_print(Framebuffer fb); +/* c is a byte */ +#define get_input(c) read(STDIN_FILENO, &c, 1) + #endif /* FRAMEBUFFER_H_ */ |
