aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-07-12 13:45:55 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-07-12 13:45:55 +0200
commit99cf1aea86c6a414604cf9eb06588f01bd8a30ef (patch)
treee5ad2758456299018b4c3ba4a08bbd94ace513e7 /src
parentb199c51c8728cf966747a837d202d214f5fe352d (diff)
downloadAsciiMap-99cf1aea86c6a414604cf9eb06588f01bd8a30ef.tar.gz
Added fit to screen mode
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index da30c28..a6b83b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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();