diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2020-05-12 00:25:42 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2020-05-12 00:25:42 +0200 |
commit | 28baa52191099820ed2d1d5a33a0d29e50d82033 (patch) | |
tree | 5dd899ef4bc2d557e906e2f33c0a9808cf110760 /src/main.c | |
parent | 44cecf8d0b792c69cdfc398761d2ad27b05a122e (diff) | |
download | AsciiMap-28baa52191099820ed2d1d5a33a0d29e50d82033.tar.gz |
Added custom character palette
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -22,6 +22,7 @@ struct prog_param { char *filename; + char *character_map; unsigned int charsize_x; unsigned int charsize_y; uint8_t color; @@ -153,7 +154,7 @@ int main(int argc, char *argv[]) if(args.use_whitespace) printf(" "); else - printf("%c", calc_char(ascii_buff[x][y], b_min, b_max)); + printf("%c", calc_char(ascii_buff[x][y], b_min, b_max, args.character_map)); } printf("\e[0m\n"); } @@ -186,7 +187,6 @@ struct prog_param parse_args(int argc, char *argv[]) memset(&ret, 0, sizeof ret); - ret.filename = NULL; ret.charsize_x = CHAR_SIZE_X; for (int i = 1; i < argc; i++) { @@ -196,17 +196,13 @@ struct prog_param parse_args(int argc, char *argv[]) switch(argv[icpy][o]) { case 'h': print_help(); - exit(1); + exit(0); break; case 'x': - DEBUG_PRINTF("x\n"); - i++; - ret.charsize_x = atoi(argv[i]); + ret.charsize_x = atoi(argv[++i]); break; case 'y': - DEBUG_PRINTF("y\n"); - i++; - ret.charsize_y = atoi(argv[i]); + ret.charsize_y = atoi(argv[++i]); break; case 'c': ret.color = 1; @@ -218,12 +214,14 @@ struct prog_param parse_args(int argc, char *argv[]) ret.use_whitespace = 1; break; case 's': - i++; - ret.fit_width = atoi(argv[i]); + ret.fit_width = atoi(argv[++i]); break; case 'd': ret.dynamic_range = 1; break; + case 'm': + ret.character_map = argv[++i]; + break; default: printf("Unrecognized Option '%c'\n", argv[icpy][o]); print_help(); @@ -260,7 +258,7 @@ void print_help( void ) printf("Options:\n -h: Print this help message\n -x VAL: set the width of block wich makes up one character. Default: %i\n", CHAR_SIZE_X); printf(" -y VAL: set the height of block wich makes up one character. Default: 2*x\n -c: Print in ANSI color mode. Default: OFF\n"); printf(" -i: Read from STDIN instead of file.\n -w: print only whitespaces with background color\n"); - printf(" -d: Dynamic brightness range"); + printf(" -d: Dynamic brightness range\n -m PALETTE: specify custom character palette from darkest to brightest\n"); } |