Generate border lines separately

This commit is contained in:
The Magician 2024-03-15 15:17:14 +00:00
parent 823513e474
commit 72461058ed
1 changed files with 10 additions and 0 deletions

10
griddle
View File

@ -20,12 +20,22 @@ generate_lines() {
width="$3"
height="$4"
# Generate border lines
border_width=$((width - 1))
border_height=$((height - 1))
printf "line 0, 0 0, %d " $border_height
printf "line 0, 0 %d, 0 " $border_width
printf "line 0, %d %d, %d " $border_height $border_width $border_height
printf "line %d, 0 %d, %d " $border_width $border_width $border_height
# Generate column separators
colwidth=$((width / columns))
for i in $(seq 0 $columns); do
current_colwidth=$((colwidth * i))
printf "line %d, 0 %d, %d " $current_colwidth $current_colwidth $height
done
# Generate row separators
rowheight=$((height / rows))
for i in $(seq 0 $rows); do
current_rowheight=$((rowheight * i))