From 8091e5c7e0eb9842a5b7f16a7cc4911889db1647 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 5 Dec 2020 03:37:22 -0500 Subject: [PATCH] demo: plot by decisecond instead of second #1081 --- src/demo/hud.c | 10 +++++----- src/demo/zoo.c | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/demo/hud.c b/src/demo/hud.c index 6c73f586f..ba0277be4 100644 --- a/src/demo/hud.c +++ b/src/demo/hud.c @@ -512,8 +512,8 @@ demo_nanosleep_abstime_ns(struct notcurses* nc, uint64_t deadline){ clock_gettime(CLOCK_MONOTONIC, &now); while(deadline > timespec_to_ns(&now)){ fsleep.tv_sec = 0; - fsleep.tv_nsec = GIG / 10; - if(deadline - timespec_to_ns(&now) < GIG / 10){ + fsleep.tv_nsec = GIG / 100; + if(deadline - timespec_to_ns(&now) < GIG / 100){ fsleep.tv_nsec = deadline - timespec_to_ns(&now); } ncinput ni; @@ -562,7 +562,7 @@ int demo_render(struct notcurses* nc){ if(!plot_hidden){ ncplane_move_top(ncuplot_plane(plot)); } - uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / GIG; + uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / (GIG / 10); ncuplot_add_sample(plot, ns, 1); } if(menu){ @@ -636,8 +636,8 @@ int fpsgraph_init(struct notcurses* nc){ memset(&opts, 0, sizeof(opts)); opts.flags = NCPLOT_OPTION_LABELTICKSD | NCPLOT_OPTION_EXPONENTIALD; opts.gridtype = NCBLIT_BRAILLE; - opts.legendstyle = NCSTYLE_ITALIC; - opts.title = "frames per second"; + opts.legendstyle = NCSTYLE_ITALIC | NCSTYLE_BOLD; + opts.title = "frames per decisecond"; channels_set_fg_rgb8(&opts.minchannels, 0x80, 0x80, 0xff); channels_set_bg_rgb(&opts.minchannels, 0x201020); channels_set_bg_alpha(&opts.minchannels, CELL_ALPHA_BLEND); diff --git a/src/demo/zoo.c b/src/demo/zoo.c index 63bcd3c2b..602087704 100644 --- a/src/demo/zoo.c +++ b/src/demo/zoo.c @@ -159,11 +159,13 @@ reader_post(struct notcurses* nc, struct ncselector* selector, struct ncmultisel return ret; } }while(cur < targ); + struct timespec fadedelay; + ns_to_timespec(timespec_to_ns(&demodelay) * 2, &fadedelay); if(notcurses_canfade(nc)){ - if(ncplane_fadeout(ncselector_plane(selector), &demodelay, demo_fader, NULL)){ + if(ncplane_fadeout(ncselector_plane(selector), &fadedelay, demo_fader, NULL)){ return -1; } - if(ncplane_fadeout(ncmultiselector_plane(mselector), &demodelay, demo_fader, NULL)){ + if(ncplane_fadeout(ncmultiselector_plane(mselector), &fadedelay, demo_fader, NULL)){ return -1; } }