diff --git a/drawing.lisp b/drawing.lisp index 2680410..e8bb343 100644 --- a/drawing.lisp +++ b/drawing.lisp @@ -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)))