diff options
| author | Albert Cervin <albert@acervin.com> | 2022-12-21 15:29:21 +0100 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2022-12-21 15:29:21 +0100 |
| commit | 690786504fce73edea78c7ec13b34771771e4caf (patch) | |
| tree | 0a8927e6ab88bb5118eca569fdc4ae3593d7f178 /src/display.h | |
| parent | a817e01bfe2356fdd860010d46db4e4361f343a6 (diff) | |
| download | dged-690786504fce73edea78c7ec13b34771771e4caf.tar.gz dged-690786504fce73edea78c7ec13b34771771e4caf.tar.xz dged-690786504fce73edea78c7ec13b34771771e4caf.zip | |
wip render rework
Diffstat (limited to 'src/display.h')
| -rw-r--r-- | src/display.h | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/display.h b/src/display.h index 088a487..c1c3667 100644 --- a/src/display.h +++ b/src/display.h @@ -1,3 +1,4 @@ +#include <stddef.h> #include <stdint.h> #include <termios.h> @@ -9,7 +10,7 @@ struct display { uint32_t height; }; -struct render_cmd { +struct render_command { uint32_t col; uint32_t row; @@ -17,11 +18,15 @@ struct render_cmd { uint32_t len; }; -struct render_cmd_buf { - struct render_cmd *cmds; +struct command_list { + struct render_command *cmds; uint64_t ncmds; + uint64_t capacity; uint32_t xoffset; uint32_t yoffset; + + uint8_t format[64]; + uint32_t format_len; }; struct display display_create(); @@ -29,5 +34,23 @@ void display_destroy(struct display *display); void display_clear(struct display *display); void display_move_cursor(struct display *display, uint32_t row, uint32_t col); -void display_update(struct display *display, struct render_cmd_buf *cmd_bufs, - uint32_t ncmd_bufs, uint32_t currow, uint32_t curcol); + +void display_begin_render(struct display *display); +void display_render(struct display *display, struct command_list *command_list); +void display_end_render(struct display *display); + +typedef void *(*alloc_fn)(size_t); +struct command_list *command_list_create(uint32_t capacity, alloc_fn allocator, + uint32_t xoffset, uint32_t yoffset); + +void command_list_set_index_color_bg(struct command_list *list, + uint8_t color_idx); +void command_list_set_color_bg(struct command_list *list, uint8_t red, + uint8_t green, uint8_t blue); +void command_list_set_index_color_fg(struct command_list *list, + uint8_t color_idx); +void command_list_set_color_fg(struct command_list *list, uint8_t red, + uint8_t green, uint8_t blue); +void command_list_reset_color(struct command_list *list); +void command_list_draw_text(struct command_list *list, uint32_t col, + uint32_t row, uint8_t *data, uint32_t len); |
