1853c4990610

Fuck around with my charms dev branch
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 06 Jan 2017 14:43:30 +0000
parents 080c2eeb0986
children c034e194a114
branches/tags (none)
files src/ascii.lisp

Changes

--- a/src/ascii.lisp	Fri Jan 06 00:09:20 2017 +0000
+++ b/src/ascii.lisp	Fri Jan 06 14:43:30 2017 +0000
@@ -59,10 +59,10 @@
      (unwind-protect (progn ,@body)
        (charms:destroy-window ,symbol))))
 
-(defmacro with-panel ((symbol window) &body body)
-  `(let ((,symbol (charms:make-panel ,window)))
-     (unwind-protect (progn ,@body)
-       (charms:destroy-panel ,symbol))))
+; (defmacro with-panel ((symbol window) &body body)
+;   `(let ((,symbol (charms:make-panel ,window)))
+;      (unwind-protect (progn ,@body)
+;        (charms:destroy-panel ,symbol))))
 
 (defmacro with-windows (bindings &body body)
   (if (null bindings)
@@ -71,40 +71,59 @@
        (with-windows ,(rest bindings)
          ,@body))))
 
-(defmacro with-panels (bindings &body body)
-  (if (null bindings)
-    `(progn ,@body)
-    `(with-panel ,(first bindings)
-       (with-panels ,(rest bindings)
-         ,@body))))
+; (defmacro with-panels (bindings &body body)
+;   (if (null bindings)
+;     `(progn ,@body)
+;     `(with-panel ,(first bindings)
+;        (with-panels ,(rest bindings)
+;          ,@body))))
+
+
+; (defun run ()
+;   (setf *running* t)
+;   (charms:with-curses ()
+;     (charms:disable-echoing)
+;     (charms:enable-raw-input :interpret-control-characters t)
+;     (charms:enable-extra-keys charms:*standard-window*)
+;     (charms:enable-non-blocking-mode charms:*standard-window*)
 
+;     (with-windows ((x-win 20 20 1 1)
+;                    (ball-win 10 10 0 0)
+;                    (o-win 5 5 4 0))
+;       (fill-window x-win 20 20 #\x)
+;       (fill-window o-win 5 5 #\O)
+;       ; (with-panels ((x-pan x-win)
+;       ;               (ball-pan ball-win)
+;       ;               (o-pan o-win))
+;       (iterate
+;         (while *running*)
+;         (manage-screen)
+;         (handle-input)
+;         (tick)
+;         ; (charms:move-panel ball-pan *window-x* *window-y*)
+;         (render ball-win)
+;         ; (charms:update-panels)
+;         (charms:update)
+;         (sleep 0.1))
+;       ; )
+;       )))
 
 (defun run ()
   (setf *running* t)
   (charms:with-curses ()
     (charms:disable-echoing)
     (charms:enable-raw-input :interpret-control-characters t)
+    (charms:enable-extra-keys charms:*standard-window*)
     (charms:enable-non-blocking-mode charms:*standard-window*)
 
-    (with-windows ((x-win 20 20 1 1)
-                   (ball-win 10 10 0 0)
-                   (o-win 5 5 4 0))
-      (fill-window x-win 20 20 #\x)
-      (fill-window o-win 5 5 #\O)
-      (with-panels ((x-pan x-win)
-                    (ball-pan ball-win)
-                    (o-pan o-win))
-        (iterate
-          (while *running*)
-          (manage-screen)
-          (handle-input)
-          (tick)
-          (charms:move-panel ball-pan *window-x* *window-y*)
-          (render ball-win)
-          (charms:update-panels)
-          (charms:update)
-          (sleep 0.1))))))
-
+    (fill-window t 20 20 #\#)
+    (iterate
+      (while *running*)
+      (manage-screen)
+      (handle-input)
+      (tick)
+      (charms:refresh-window t)
+      (sleep 0.1))))
 
 ; (run)