From 64857e12ac9c3719b012ae3131e339f47a46a26f Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 28 Jun 2020 20:34:12 -0400 Subject: [PATCH] HUD: glyph transparency on frame count #743 --- src/demo/hud.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/demo/hud.c b/src/demo/hud.c index f2d7cf638..d9d95ea95 100644 --- a/src/demo/hud.c +++ b/src/demo/hud.c @@ -305,10 +305,13 @@ hud_print_finished(int* line){ ncplane_set_bg_alpha(hud, CELL_ALPHA_BLEND); ncplane_set_fg(hud, 0xffffff); cell_release(hud, &c); - if(ncplane_printf_yx(hud, *line, 1, "%-6d %*ju.%02jus %s", e->frames, - NSLEN - 3, e->totalns / GIG, - (e->totalns % GIG) / (GIG / 100), - e->name) < 0){ + if(ncplane_printf_yx(hud, *line, 1, "%d", e->frames) < 0){ + return NULL; + } + if(ncplane_printf_yx(hud, *line, 7, "%*ju.%02jus %s", + NSLEN - 3, e->totalns / GIG, + (e->totalns % GIG) / (GIG / 100), + e->name) < 0){ return NULL; } } @@ -445,7 +448,10 @@ int hud_schedule(const char* demoname){ ncplane_set_fg(hud, 0); ncplane_set_bg_alpha(hud, CELL_ALPHA_BLEND); ncplane_set_bg(hud, 0); - if(ncplane_printf_yx(hud, line, 1, "%-6d %*ju.%02jus %s", cure->frames, + if(ncplane_printf_yx(hud, line, 1, "%d", cure->frames) < 0){ + return -1; + } + if(ncplane_printf_yx(hud, line, 7, "%*ju.%02jus %s", NSLEN - 3, cure->totalns / GIG, (cure->totalns % GIG) / (GIG / 100), cure->name) < 0){ @@ -532,8 +538,10 @@ int demo_render(struct notcurses* nc){ ncplane_set_bg_alpha(hud, CELL_ALPHA_BLEND); ncplane_set_fg(hud, 0xffffff); cell_release(hud, &c); - if(ncplane_printf_yx(hud, HUD_ROWS - 2, 1, "%-6d %*ju.%02jus %s", - running->frames, + if(ncplane_printf_yx(hud, HUD_ROWS - 2, 1, "%d", running->frames) < 0){ + return -1; + } + if(ncplane_printf_yx(hud, HUD_ROWS - 2, 7, "%*ju.%02jus %s", NSLEN - 3, ns / GIG, (ns % GIG) / (GIG / 100), running->name) < 0){ return -1;