Skip to content

Instantly share code, notes, and snippets.

@johnfredcee
Last active January 2, 2016 03:19
Show Gist options
  • Select an option

  • Save johnfredcee/8243349 to your computer and use it in GitHub Desktop.

Select an option

Save johnfredcee/8243349 to your computer and use it in GitHub Desktop.
Stub for CL-TCOD
(defparameter *x* 45)
(defparameter *y* 20)
(defparameter *running* t)
(defun main ()
(tcod:console-init-root 80 50 :title "Libtcod Lisp Tutorial" :fullscreen? nil :renderer :renderer-sdl)
(loop
while *running*
do
(tcod::console-clear tcod:*root*)
(tcod::console-put-char tcod:*root* *x* *y* (char-code #\@) :set)
(tcod::console-flush)
(let ((events (tcod:sys-get-events)))
(loop
for e in events
do
(format t "~A~%" e)
(case (car e)
(:event-key-release (incf *x*))
(:event-key (incf *x*))
(:event-mouse-press (setf *running* nil)))))))
(defun rerun ()
(setf *running* t)
(main))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment