src/main.lisp @ e953b1af4b62

Boots boilerplate
author Steve Losh <steve@stevelosh.com>
date Sun, 18 Apr 2021 14:03:33 -0400
parents ae5d604f978f
children 41f2c758451f
(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 ()
  (sb-ext:disable-debugger)
  (run))

(defun build ()
  (sb-ext:save-lisp-and-die "build/dark"
    :executable t
    :save-runtime-options t
    :toplevel #'dark:toplevel))