Create with-graphics-context macro

This commit is contained in:
Camden Dixie O'Brien 2025-05-29 01:14:30 +01:00
parent 4fc83b269a
commit be7fa37495

View File

@ -92,6 +92,12 @@
(sdl2:destroy-window window)
(sdl2:quit)))
(defmacro with-graphics-context ((var &rest args) &body body)
`(let ((,var (make-instance 'graphics-context ,@args)))
(unwind-protect
(progn ,@body)
(cleanup ,var))))
(define-transform project-to-screen (screen-height)
:x-transform (round x)
:y-transform (round (- screen-height y)))