From 115753a1ea4c9aed84ecb70f0261766ec4addcb3 Mon Sep 17 00:00:00 2001 From: Kied Llaentenn <32681240+Kiedtl@users.noreply.github.com> Date: Fri, 13 Dec 2019 16:35:13 -0500 Subject: [PATCH] fix some minor bugs --- colors.h | 4 ++-- draw.c | 16 +++++++--------- main.c | 5 +++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/colors.h b/colors.h index 293e784..3bd8f1a 100644 --- a/colors.h +++ b/colors.h @@ -7,7 +7,7 @@ #define RED 0xdd1111 #define BLACK 0x000000 -#define YELLOW 0xffdd00 +#define YELLOW 0xff7700 #define WHITE 0xffffff struct tb_cell normcolors[CLRS_LEN] = @@ -37,7 +37,7 @@ struct tb_cell normcolors[CLRS_LEN] = struct tb_cell truecolors[CLRS_LEN] = { // default - { ' ', 9, 0 }, + { ' ', 9, 0 }, // red/black { 0x2591, RED, BLACK }, diff --git a/draw.c b/draw.c index 7c859c3..5a81f51 100644 --- a/draw.c +++ b/draw.c @@ -66,15 +66,13 @@ dofire ( struct buffer *buf ) if (buf->buf[dest] > 12) buf->buf[dest] = 0; - if (opts->truecolor) { - realbuf[dest] = truecolors[buf->buf[dest]]; - realbuf[src] = truecolors[buf->buf[src]]; - } - else - { - realbuf[dest] = normcolors[buf->buf[dest]]; - realbuf[src] = normcolors[buf->buf[src]]; - } + struct tb_cell *colors; + if (opts->truecolor == TRUE) + colors = (struct tb_cell*) &truecolors; + else colors = (struct tb_cell*) &normcolors; + + realbuf[dest] = colors[buf->buf[dest]]; + realbuf[src] = colors[buf->buf[src]]; } } } diff --git a/main.c b/main.c index d21f530..3b69d54 100644 --- a/main.c +++ b/main.c @@ -25,13 +25,14 @@ main ( int argc, char *argv[] ) // default args opts->refresh_rate = 5; opts->truecolor = FALSE; + usize output_mode = TB_OUTPUT_NORMAL; // argument parsing argv0 = argv[0]; ARGBEGIN { case 't': - tb_select_output_mode(TB_OUTPUT_TRUECOLOR); + output_mode = TB_OUTPUT_TRUECOLOR; opts->truecolor = TRUE; break; case 'r': @@ -53,7 +54,7 @@ main ( int argc, char *argv[] ) // initialize termbox tb_init(); - tb_select_output_mode(TB_OUTPUT_NORMAL); + tb_select_output_mode(output_mode); tb_clear(); struct buffer buf; struct tb_event e;