Added support for a custom rim different from the inner circle with the -F option

This commit is contained in:
AngelJumbo 2022-10-18 17:45:59 -05:00
parent 3835caeb84
commit 6f7716074e
2 changed files with 10 additions and 2 deletions

View File

@ -46,7 +46,7 @@ OPTIONS:
If you send more than one character to the -F option you can have 3d-ish effect. 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) ![demo 2](https://github.com/AngelJumbo/lavat/blob/demo/demo/4.gif?raw=true)

10
lavat.c
View File

@ -47,6 +47,12 @@ int main(int argc, char *argv[]) {
float innerRadius = radius * (1 + (float)(0.25 * rim)); 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++) { for (int i = 0; i < nballs; i++) {
balls[i].x = rand() % maxX; balls[i].x = rand() % maxX;
balls[i].y = rand() % maxY; balls[i].y = rand() % maxY;
@ -107,7 +113,7 @@ int main(int argc, char *argv[]) {
} }
} else { } else {
if (sum[0] > radius) { if (sum[0] > radius) {
tb_printf(i, j, color | TB_BOLD, 0, custom); tb_printf(i, j, color | TB_BOLD, 0, custom2);
} }
if (rim) { if (rim) {
@ -224,5 +230,7 @@ void print_help() {
" -b NBALLS Set the number of metaballs in the simulation, from " " -b NBALLS Set the number of metaballs in the simulation, from "
"2 to 20. (default: 10)\n" "2 to 20. (default: 10)\n"
" -F CHARS Allows for a custom set of chars to be used\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"); " -h Print help.\n");
} }