test custom curses implementation
This commit is contained in:
parent
04e5688d82
commit
342886a098
2 changed files with 135 additions and 0 deletions
41
lib/cursed.h
Normal file
41
lib/cursed.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef CURSED_H
|
||||
#define CURSED_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/termios.h>
|
||||
|
||||
#define PACKED __attribute__((packed, aligned(1)))
|
||||
#define PUBLIC __attribute((visibility("default")))
|
||||
#define PROTECTED __attribute__((visibility("hidden")))
|
||||
#define PRIVATE static
|
||||
|
||||
#define _INIT __attribute__((constructor))
|
||||
#define _FINI __attribute__((destructor))
|
||||
|
||||
typedef unsigned char uid; // >= 8B
|
||||
typedef unsigned short int pos; // >= 16B
|
||||
|
||||
struct s_framebuffer {
|
||||
pos *buf; // framebuffer
|
||||
bool bitmap[];
|
||||
} PACKED;
|
||||
|
||||
struct s_window {
|
||||
uid id;
|
||||
pos cols;
|
||||
pos rows;
|
||||
struct s_framebuffer frame;
|
||||
|
||||
pos x;
|
||||
pos y;
|
||||
} PACKED;
|
||||
|
||||
struct s_state {
|
||||
struct termios term;
|
||||
} PACKED;
|
||||
|
||||
// === Public API ===
|
||||
PRIVATE struct s_framebuffer *init_framebuffer(pos cols, pos rows);
|
||||
PUBLIC struct s_window *init_window(uid id, pos cols, pos rows);
|
||||
|
||||
#endif /* CURSED_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue