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 RED 0xdd1111
#define BLACK 0x000000 #define BLACK 0x000000
#define YELLOW 0xffdd00 #define YELLOW 0xff7700
#define WHITE 0xffffff #define WHITE 0xffffff
struct tb_cell normcolors[CLRS_LEN] = struct tb_cell normcolors[CLRS_LEN] =

16
draw.c
View File

@ -66,15 +66,13 @@ dofire ( struct buffer *buf )
if (buf->buf[dest] > 12) if (buf->buf[dest] > 12)
buf->buf[dest] = 0; buf->buf[dest] = 0;
if (opts->truecolor) { struct tb_cell *colors;
realbuf[dest] = truecolors[buf->buf[dest]]; if (opts->truecolor == TRUE)
realbuf[src] = truecolors[buf->buf[src]]; colors = (struct tb_cell*) &truecolors;
} else colors = (struct tb_cell*) &normcolors;
else
{ realbuf[dest] = colors[buf->buf[dest]];
realbuf[dest] = normcolors[buf->buf[dest]]; realbuf[src] = colors[buf->buf[src]];
realbuf[src] = normcolors[buf->buf[src]];
}
} }
} }
} }

5
main.c
View File

@ -25,13 +25,14 @@ main ( int argc, char *argv[] )
// default args // default args
opts->refresh_rate = 5; opts->refresh_rate = 5;
opts->truecolor = FALSE; opts->truecolor = FALSE;
usize output_mode = TB_OUTPUT_NORMAL;
// argument parsing // argument parsing
argv0 = argv[0]; argv0 = argv[0];
ARGBEGIN { ARGBEGIN {
case 't': case 't':
tb_select_output_mode(TB_OUTPUT_TRUECOLOR); output_mode = TB_OUTPUT_TRUECOLOR;
opts->truecolor = TRUE; opts->truecolor = TRUE;
break; break;
case 'r': case 'r':
@ -53,7 +54,7 @@ main ( int argc, char *argv[] )
// initialize termbox // initialize termbox
tb_init(); tb_init();
tb_select_output_mode(TB_OUTPUT_NORMAL); tb_select_output_mode(output_mode);
tb_clear(); tb_clear();
struct buffer buf; struct buffer buf;
struct tb_event e; struct tb_event e;