From 636f1ec09b1f2662e7853974abb5267aa899e115 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 17 Feb 2020 02:13:55 -0500 Subject: [PATCH] demo: on restart, maintain HUD if up --- src/demo/demo.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/demo/demo.c b/src/demo/demo.c index d0ed08057..754d20469 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -439,18 +439,27 @@ int main(int argc, char** argv){ nanosleep(&demodelay, NULL); } } + // if we're restarted with the HUD up, we want it to seamlessly restart + bool start_with_hud = false; do{ restart_demos = false; interrupted = false; notcurses_drop_planes(nc); + if(start_with_hud){ + if(!hud_create(nc)){ + goto err; + } + } if(menu_create(nc) == NULL){ goto err; } if(ext_demos(nc, spec, ignore_failures) == NULL){ goto err; } - if(hud_destroy()){ // destroy here since notcurses_drop_planes will kill it - goto err; + if( (start_with_hud = !!hud) ){ + if(hud_destroy()){ // destroy here since notcurses_drop_planes will kill it + goto err; + } } }while(restart_demos); if(stop_input()){