Add a thinkballoon function for generating thought bubbles

This commit is contained in:
Thomas A. Christensen II 2022-01-11 19:11:20 -06:00
parent e6e38b94ed
commit 09882d4768
Signed by: millironx
GPG key ID: 139C07724802BC5D

View file

@ -145,5 +145,35 @@ function sayballoon(message::AbstractString)
end #function
function thinkballoon(message::AbstractString)
messagelines = split(message, "\n")
nlines = length(messagelines)
linelength = max(length.(messagelines)...)
paddinglength = linelength + 2
balloon = string(
" ",
repeat("_", paddinglength),
"\n"
)
for i in 1:nlines
balloon = string(
balloon,
"( ",
rpad(messagelines[i], linelength),
" )\n"
)
end #for
balloon = string(
balloon,
" ",
repeat("-", paddinglength),
"\n"
)
return balloon
end #function
end