guile-guart/gaart/draw.scm
2024-03-11 00:14:44 -04:00

17 lines
539 B
Scheme

(define-module (gaart draw)
#:use-module (gaart)
#:use-module (gaart buffer)
#:use-module (ice-9 match)
#:export (draw-here))
(define* (draw-here ga #:optional (port #f))
(unless port
(set! port (current-output-port)))
(match-let* ((($ <gaart> w h draw) ga)
(buf (make-buffer w h))
(okay? (λ (width height rpos cpos) #t))
(blit! (λ (rpos cpos grapheme)
(buffer-set! buf rpos cpos grapheme))))
(draw okay? blit! 0 0)
(write-buffer buf port)))