From 0805372ed5460cf4a886e04bf65a5895413463a3 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 11 Jan 2023 16:42:14 -0800 Subject: main: experimenting with ANSI codes for --print-pipes This turns --print-pipes into a more top-like display. Redirect the FPS on stderr somewhere else to get less flickering e.g. 2>/dev/null pipes print to stdout. --- src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 37fef55..2e0229e 100644 --- a/src/main.c +++ b/src/main.c @@ -336,8 +336,10 @@ static void * rototiller_thread(void *_rt) til_module_render(rt->module_context, rt->stream, ticks, &fragment); til_fb_fragment_submit(fragment); - if (rt->args.print_pipes) /* render threads are idle at this point */ + if (rt->args.print_pipes) { /* render threads are idle at this point */ + printf("\x1b[2J\x1b[;H"); /* ANSI codes for clear screen and move cursor to top left */ til_stream_fprint(rt->stream, stdout); + } } return NULL; -- cgit v1.2.1