diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-07-12 13:45:55 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-07-12 13:45:55 +0200 |
commit | 99cf1aea86c6a414604cf9eb06588f01bd8a30ef (patch) | |
tree | e5ad2758456299018b4c3ba4a08bbd94ace513e7 /src/main.c | |
parent | b199c51c8728cf966747a837d202d214f5fe352d (diff) | |
download | AsciiMap-99cf1aea86c6a414604cf9eb06588f01bd8a30ef.tar.gz |
Added fit to screen mode
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -27,6 +27,7 @@ struct prog_param uint8_t color; uint8_t use_stdin; uint8_t use_whitespace; + uint8_t fit_width; }; struct prog_param parse_args(int argc, char *argv[]); @@ -56,6 +57,13 @@ int main(int argc, char *argv[]) //x and y size of ASCII-image unsigned int size_x,size_y; + + if(args.fit_width > 0) { + args.charsize_x = bitmap.x / args.fit_width; + args.charsize_y = (bitmap.y / bitmap.x) * args.charsize_x * 2; + } + /*size_x = args.fit_width; + size_y = (unsigned int)(((float)size_x / (float)bitmap.x) * (float)bitmap.y);*/ size_x = bitmap.x / args.charsize_x; size_y = bitmap.y / args.charsize_y; @@ -174,6 +182,8 @@ struct prog_param parse_args(int argc, char *argv[]) ret.charsize_y = 0; ret.color = 0; ret.use_stdin = 0; + ret.use_whitespace = 0; + ret.fit_width = 0; for (int i = 1; i < argc; i++) { if(argv[i][0] == '-') { @@ -203,6 +213,10 @@ struct prog_param parse_args(int argc, char *argv[]) case 'w': ret.use_whitespace = 1; break; + case 's': + i++; + ret.fit_width = atoi(argv[i]); + break; default: printf("Unrecognized Option '%c'\n", argv[icpy][o]); print_help(); |