From 6f7716074eac1004c62d063d24cfed892a65c093 Mon Sep 17 00:00:00 2001 From: AngelJumbo Date: Tue, 18 Oct 2022 17:45:59 -0500 Subject: [PATCH] Added support for a custom rim different from the inner circle with the -F option --- README.md | 2 +- lavat.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e77ba18..3297b5b 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ OPTIONS: If you send more than one character to the -F option you can have 3d-ish effect. -`lavat -c blue -R2 -F @:::::: -r10` +`lavat -c blue -R2 -F @@:::::: -r10` ![demo 2](https://github.com/AngelJumbo/lavat/blob/demo/demo/4.gif?raw=true) diff --git a/lavat.c b/lavat.c index 883eb62..b3144e3 100644 --- a/lavat.c +++ b/lavat.c @@ -47,6 +47,12 @@ int main(int argc, char *argv[]) { float innerRadius = radius * (1 + (float)(0.25 * rim)); + char *custom2 = custom; + + if (strlen(custom) > 1 && rim) { + custom2 = custom + 1; + } + for (int i = 0; i < nballs; i++) { balls[i].x = rand() % maxX; balls[i].y = rand() % maxY; @@ -107,7 +113,7 @@ int main(int argc, char *argv[]) { } } else { if (sum[0] > radius) { - tb_printf(i, j, color | TB_BOLD, 0, custom); + tb_printf(i, j, color | TB_BOLD, 0, custom2); } if (rim) { @@ -224,5 +230,7 @@ void print_help() { " -b NBALLS Set the number of metaballs in the simulation, from " "2 to 20. (default: 10)\n" " -F CHARS Allows for a custom set of chars to be used\n" + " Only ascii symbols are supported for now, " + "wide/unicode chars may appear broken.\n" " -h Print help.\n"); }