;;;; ;;;; Terra Nostra is a Minecraft-like survival game for the commandline. ;;;; ;;;; This is the main program file. ;;;; ;;;; (c) 2018 Daniel Vedder, MIT license ;;;; (defvar *debugging* T) (ql:quickload :croatoan) (use-package :croatoan) (load "util.lisp") (load "items.lisp") (load "biomes.lisp") (load "animals.lisp") (load "world.lisp") (defun user-interface () "Create the screen on the ncurses interface and hand over to window functions" ;;TODO (with-screen (scr :input-echoing nil :input-blocking t :enable-colors t :cursor-visibility nil :input-reading :unbuffered) (let* ((width (.width scr)) (height (.height scr)) (me (list (round (/ width 2)) (round (/ height 2))))) (setf (.color-pair scr) '(:green :black)) (draw-test-map scr height width me) ;(draw-map (floor (/ w 2)) h) ;(draw-info-panel (ceiling (/ w 2) h)) (event-case (scr event) (#\q (return-from event-case)) (:up (decf (second me)) (draw-test-map scr height width me)) (:down (incf (second me)) (draw-test-map scr height width me)) (:left (decf (first me)) (draw-test-map scr height width me)) (:right (incf (first me)) (draw-test-map scr height width me)))))) (defun draw-test-map (scr height width me) (clear scr) (box scr) (dotimes (h height) (dotimes (w width) (if (and (= w (first me)) (= h (second me))) (progn (setf (.color-pair scr) '(:white :black)) (add-char scr #\X) (setf (.color-pair scr) '(:green :black))) (add-char scr #\;))) (new-line scr)) (refresh scr)) ;;;FIXME my croatoan version doesn't have `with-window` yet, for some reason... ;; (defun draw-map (width height) ;; "Draw a portion of the game map in an ncurses window" ;; ;;TODO ;; (with-window (mapwin :position '(0 0) :width width :height height ;; :cursor-position '(0 0) :input-blocking t :border t) ;; (dotimes (h height) ;; (add mapwin #\. :n -1)))) ;; (defun draw-info-panel (width height) ;; "Draw the info panel and associated information in an ncurses window" ;; ;;TODO ;; ) (defun process-command (event) ) ;; Initialize the random state (which would otherwise not be very random...) (setf *random-state* (make-random-state t)) ;(create-world 100 "test.world") (user-interface)