# HG changeset patch # User Steve Losh # Date 1618769013 14400 # Node ID e953b1af4b62172931c7713a6650f752fc9eec80 # Parent ae5d604f978f84c3d440f69dbeb1ffc19674576e Boots boilerplate diff -r ae5d604f978f -r e953b1af4b62 src/main.lisp --- a/src/main.lisp Sun Apr 18 13:49:33 2021 -0400 +++ b/src/main.lisp Sun Apr 18 14:03:33 2021 -0400 @@ -1,8 +1,38 @@ (in-package :dark) +(defun press-any-key () + (boots:read-event) + (values)) + +(defparameter *splash* (format nil "~ + TODO: title~@ + by Steve Losh ~@ + for the Lisp Game Jam, Spring 2021~@ + ~@ + Press any key to start.")) + +(defmacro with-ui (ui &body body) + `(unwind-protect (progn (setf (boots:root boots:*screen*) ,ui) + ,@body) + (setf (boots:root boots:*screen*) nil))) + +(defun draw/splash (pad) + (boots:draw pad 0 0 *splash*)) + +(defun splash () + (with-ui (boots:make-canvas :width 50 :height 10 :border 1 :margin t :draw #'draw/splash) + (boots:redraw) + (press-any-key))) + +(defun run () + (boots/terminals/ansi:with-ansi-terminal (terminal :truecolor t) + (boots:with-screen (boots:*screen* terminal) + (boots:with-light-borders + (splash))))) + (defun toplevel () - (write-line "Hello, world!") - (write-line "example")) + (sb-ext:disable-debugger) + (run)) (defun build () (sb-ext:save-lisp-and-die "build/dark"