e953b1af4b62

Boots boilerplate
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 18 Apr 2021 14:03:33 -0400
parents ae5d604f978f
children 41f2c758451f
branches/tags (none)
files src/main.lisp

Changes

--- 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"