; SPDX-FileCopyrightText: 2023 Jummit
;
; SPDX-License-Identifier: GPL-3.0-or-later
(fn draw-portraits [entities]
(each [_ entity (ipairs entities)]
(case entity
{:portrait {: name : portrait} : x : y}
(let [colors (if entity.border [9 10 13] [8 10 9])]
(for [i 3 1 -1]
(let [w (+ 40 (* i 2))]
(_G.rect (- x i) (- y i) w w (. colors i))))
(_G.spr portrait x y -1 1 0 0 5 5)
(_G.print name x (+ y 46) 13)))))
{: draw-portraits}