fix some minor bugs

This commit is contained in:
Kied Llaentenn 2019-12-13 16:35:13 -05:00
parent f1b427d6cb
commit 115753a1ea
3 changed files with 12 additions and 13 deletions

View File

@ -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 },

16
draw.c
View File

@ -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]];
}
}
}

5
main.c
View File

@ -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;