From e36a42bb2473c293a49dc9da6b369f383e81a66c Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 16 May 2020 18:06:55 -0400 Subject: [PATCH] xray demo: adapt to new streaming API --- src/demo/xray.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/demo/xray.c b/src/demo/xray.c index 9f5113c8f..7da40ac79 100644 --- a/src/demo/xray.c +++ b/src/demo/xray.c @@ -1,5 +1,7 @@ #include "demo.h" +// FIXME turn this into one large plane and move the plane, ratrher than +// manually redrawing each time static const char* leg[] = { " 88 88 88 88 88 88 88 ", " \"\" 88 88 88 88 \"\" \"\" ,d ", @@ -13,20 +15,9 @@ static const char* leg[] = { " 888P ", }; -static int -watch_for_keystroke(struct notcurses* nc){ - wchar_t w; - if((w = demo_getc_nblock(nc, NULL)) != (wchar_t)-1){ - if(w == 'q'){ - return 1; - } - } - return demo_render(nc); -} - static int perframecb(struct notcurses* nc, struct ncvisual* ncv __attribute__ ((unused)), - void* vnewplane){ + const struct timespec* tspec, void* vnewplane){ static int startr = 0x5f; static int startg = 0xaf; static int startb = 0x84; @@ -92,7 +83,9 @@ perframecb(struct notcurses* nc, struct ncvisual* ncv __attribute__ ((unused)), b = t; }while(x < dimx); ++frameno; - return watch_for_keystroke(nc); + DEMO_RENDER(nc); + clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, tspec, NULL); + return 0; } int xray_demo(struct notcurses* nc){