From 8da3e6f968b6e5ac296349d2762f9c46840f74ae Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 28 Jun 2020 20:47:42 -0400 Subject: [PATCH] HUD: fully glyph-transparent, looks great #743 --- src/demo/hud.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/demo/hud.c b/src/demo/hud.c index 563bdb96e..2c70c6861 100644 --- a/src/demo/hud.c +++ b/src/demo/hud.c @@ -26,7 +26,6 @@ static int plot_grab_y = -1; static int plot_pos_y; // how many columns for runtime? -static const int NSLEN = 9; static const int HUD_ROWS = 3 + 2; // 2 for borders static const int HUD_COLS = 30 + 2; // 2 for borders @@ -308,14 +307,13 @@ hud_print_finished(int* line){ if(ncplane_printf_yx(hud, *line, 1, "%d", e->frames) < 0){ return NULL; } - if(ncplane_printf_yx(hud, *line, 7, "%*ju.%02jus", - NSLEN - 3, e->totalns / GIG, + if(ncplane_printf_yx(hud, *line, 7, "%ju.%02jus", e->totalns / GIG, (e->totalns % GIG) / (GIG / 100)) < 0){ return NULL; } - } - if(ncplane_putstr_yx(hud, *line, 18, e->name) < 0){ - return -1; + if(ncplane_putstr_yx(hud, *line, 18, e->name) < 0){ + return NULL; + } } ++*line; e = e->next; @@ -453,8 +451,7 @@ int hud_schedule(const char* demoname){ if(ncplane_printf_yx(hud, line, 1, "%d", cure->frames) < 0){ return -1; } - if(ncplane_printf_yx(hud, line, 7, "%*ju.%02jus", - NSLEN - 3, cure->totalns / GIG, + if(ncplane_printf_yx(hud, line, 7, "%ju.%02jus", cure->totalns / GIG, (cure->totalns % GIG) / (GIG / 100)) < 0){ return -1; } @@ -545,8 +542,8 @@ int demo_render(struct notcurses* nc){ 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", - NSLEN - 3, ns / GIG, (ns % GIG) / (GIG / 100)) < 0){ + if(ncplane_printf_yx(hud, HUD_ROWS - 2, 7, "%ju.%02jus", + ns / GIG, (ns % GIG) / (GIG / 100)) < 0){ return -1; } if(ncplane_putstr_yx(hud, HUD_ROWS - 2, 18, running->name) < 0){