From f1cfe6bab6f4e3762b1a0e29122f318741984deb Mon Sep 17 00:00:00 2001 From: AngelJumbo Date: Sat, 26 Nov 2022 23:22:57 -0500 Subject: [PATCH] More speed values --- README.md | 2 +- lavat.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 08b421b..99a5718 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Usage: lavat [OPTIONS] OPTIONS: -c Set color. Available colours: red, blue, yellow, green, cyan and magenta. Besides those colors the default one is the normal foreground of your terminal. - -s Set the speed, from 1 to 5. (default 1) + -s Set the speed, from 1 to 10. (default 5) -r Set the radius of the metaballs, from 1 to 10. (default: 5) -R Set a rim for each metaball, sizes from 1 to 5.(default: none) This option does not work with the default color. diff --git a/lavat.c b/lavat.c index b4b4390..d9bb818 100644 --- a/lavat.c +++ b/lavat.c @@ -18,7 +18,7 @@ static char *custom = NULL; static short color = TB_DEFAULT; static short color2 = TB_DEFAULT; static int nballs = 10; -static short speedMult = 1; +static short speedMult = 5; static short rim = 0; static short contained = 0; static float radius = 100; @@ -47,7 +47,8 @@ int main(int argc, char *argv[]) { int maxX = tb_width(); int maxY = tb_height() * 2; - int speed = (((1 / (float)(maxX + maxY)) * 5000000) + 50000) / speedMult; + speedMult = 11 - speedMult; + int speed = (((1 / (float)(maxX + maxY)) * 1000000) + 10000) * speedMult; radius = (radius * radius + (float)(maxX * maxY)) / 15000; int margin = contained ? radius * 10 : 0; @@ -191,8 +192,8 @@ int parse_options(int argc, char *argv[]) { break; case 's': speedMult = atoi(optarg); - if (speedMult > 5 || speedMult <= 0) { - printf("Invalid speed, only values between 1 and 5 are allowed\n"); + if (speedMult > 10 || speedMult <= 0) { + printf("Invalid speed, only values between 1 and 10 are allowed\n"); return 0; } break; @@ -250,7 +251,7 @@ void print_help() { "green, cyan and magenta. \n" " Besides those colors the default one is the normal" " foreground of your terminal.\n" - " -s Set the speed, from 1 to 5. (default 1)\n" + " -s Set the speed, from 1 to 10. (default 5)\n" " -r Set the radius of the metaballs, from 1 to 10. " "(default: 5)\n" " -R Set a rim for each metaball, sizes from 1 to 5."