guile-guart/guart/draw.scm

18 lines
539 B
Scheme
Raw Normal View History

2024-03-12 20:32:47 +00:00
(define-module (guart draw)
#:use-module (guart)
#:use-module (guart buffer)
#:use-module (ice-9 match)
#:export (draw-here))
2024-03-10 21:53:14 +00:00
(define* (draw-here ga #:optional (port #f))
(unless port
(set! port (current-output-port)))
2024-03-10 21:53:14 +00:00
2024-03-12 20:32:47 +00:00
(match-let* ((($ <guart> 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)
2024-03-11 04:14:44 +00:00
(write-buffer buf port)))