# HG changeset patch # User Steve Losh # Date 1483713810 0 # Node ID 1853c49906105cebeab5b1654ff605e31ab26842 # Parent 080c2eeb0986ad778c6a61a1dac64502d4bb614b Fuck around with my charms dev branch diff -r 080c2eeb0986 -r 1853c4990610 src/ascii.lisp --- 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)