From 2f8efe53a6a48dea3af0c00764ad71bc250f66fb Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 13 Apr 2021 11:36:16 -0400 Subject: [PATCH] [demo] shrink the fps graph horizontally a little --- src/demo/hud.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/demo/hud.c b/src/demo/hud.c index 299856f7b..df6125303 100644 --- a/src/demo/hud.c +++ b/src/demo/hud.c @@ -28,6 +28,8 @@ static int plot_pos_y; #define FPSHZ 2 +#define FPSGRAPH_MAX_COLS 72 // give it some room on each side of an 80-column term + // how many columns for runtime? #define HUD_ROWS (3 + 2) // 2 for borders static const int HUD_COLS = 23 + 2; // 2 for borders @@ -399,8 +401,8 @@ struct ncplane* hud_create(struct notcurses* nc){ struct ncplane_options nopts = { .y = yoffset, // we want it to start tucked right up underneath the title of the FPS - // graph. graph is min(80, dimx) wide, centered, and we want 6 in. - .x = (dimx - (dimx > 80 ? 80 : dimx)) / 2 + 6, + // graph. graph is min(FPSGRAPH_MAX_COLS, dimx) wide, centered, and we want 6 in. + .x = (dimx - (dimx > FPSGRAPH_MAX_COLS ? FPSGRAPH_MAX_COLS : dimx)) / 2 + 6, .rows = HUD_ROWS, .cols = HUD_COLS, .userptr = NULL, @@ -622,7 +624,7 @@ int fpsgraph_init(struct notcurses* nc){ .y = NCALIGN_BOTTOM, .x = NCALIGN_CENTER, .rows = PLOTHEIGHT, - .cols = dimx > 80 ? 80 : dimx, + .cols = dimx > FPSGRAPH_MAX_COLS ? FPSGRAPH_MAX_COLS : dimx, .userptr = NULL, .name = "fps", .resizecb = ncplane_resize_realign,