termbox2
termbox2 copied to clipboard
new function in API
It would be nice to have function
tb_get_cell(x, y)
of some kind that returns content on specific cell. It is complement to function tb_set_cell(...)
For example I want to render something over background that is dynamic, so I need to get first backround of a cell and then overite ch, but bg should remain same. I can do it with
struct tb_cell *cell;
cellbuf_get(&global.back, x, y, &cell);
but it would be better to hide implementation in my opinion and as I said to have complete API.
https://github.com/termbox/termbox2/blob/master/termbox2.h#L3334 This looks interesting we could just do the same but with
int tb_get_cell(int x, int y, uint32_t *ch, uintattr_t *fg, uintattr_t *bg);
where the pointers are the data return values and the function's return value is used for error detection.
Currently too lazy to open a PR for this, maybe later :)
PR at https://github.com/termbox/termbox2/pull/65
There is some overlap with the existing tb_cell_buffer
function.
@ledinscak in your case you may want to fetch from the front buffer instead as it will contain the latest rendered cells.
@jumps-are-op To avoid more TB_OPT_EGC
ifdefs, my PR uses one tb_cell
out param instead of separate out params for ch
, fg
, bg
.