ebd641c91236

Start the sidebar fuckery
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 07 Jan 2017 15:09:46 +0000
parents 5560e722bc5c
children 692ec1bec892
branches/tags (none)
files .lispwords src/main.lisp

Changes

--- a/.lispwords	Sat Jan 07 15:00:20 2017 +0000
+++ b/.lispwords	Sat Jan 07 15:09:46 2017 +0000
@@ -1,1 +1,1 @@
-(1 with-panel-and-window)
+(1 with-panel-and-window with-panels-and-windows)
--- a/src/main.lisp	Sat Jan 07 15:00:20 2017 +0000
+++ b/src/main.lisp	Sat Jan 07 15:09:46 2017 +0000
@@ -23,6 +23,15 @@
 
 (defparameter *wat* nil)
 (defparameter *player* nil)
+(defparameter *sidebar-width* 20)
+
+
+;;;; More Utils Lol
+(defmacro with-window-dims (window &body body)
+  (with-gensyms (w h)
+    `(multiple-value-bind (,w ,h) (charms:window-dimensions ,window)
+       (with-dims (,w ,h)
+         ,@body))))
 
 
 ;;;; Colors -------------------------------------------------------------------
@@ -167,12 +176,17 @@
 
 (defun world-map ()
   (with-dims ((- *screen-width* 2) (- *screen-height* 2))
-    (with-panel-and-window (map-pan map-win *width* *height* 0 0)
+    (with-panels-and-windows
+        ((map-pan map-win (- *width* *sidebar-width*) *height* 0 0)
+         (bar-pan bar-win *sidebar-width* *height* (- *width* *sidebar-width*) 0))
       (iterate
-        (center-view-on-player *width* *height*)
-        (render-map map-win)
+        (charms:clear-window bar-win)
+        (border bar-win)
+        (with-window-dims map-win
+          (center-view-on-player *width* *height*)
+          (render-map map-win))
         (redraw)
-        (until (eql :quit (world-map-input map-win))))))
+        (until (eql :quit (world-map-input bar-win))))))
   nil)