瀏覽代碼

Modify ncurses settings

Lily Carpenter 8 年之前
父節點
當前提交
afadf2af11
共有 1 個文件被更改,包括 12 次插入11 次删除
  1. 12 11
      src/internal.lisp

+ 12 - 11
src/internal.lisp

38
 
38
 
39
 (defun handle-input (char state)
39
 (defun handle-input (char state)
40
   (case char
40
   (case char
41
-    ((nil) nil)
42
     ((#\w) (player-up    state))
41
     ((#\w) (player-up    state))
43
     ((#\s) (player-down  state))
42
     ((#\s) (player-down  state))
44
     ((#\a) (player-left  state))
43
     ((#\a) (player-left  state))
48
 (defun start (&optional (state (make-game-state)))
47
 (defun start (&optional (state (make-game-state)))
49
   (with-curses ()
48
   (with-curses ()
50
     (disable-echoing)
49
     (disable-echoing)
51
-    (enable-raw-input :interpret-control-characters t)
52
-    (enable-non-blocking-mode *standard-window*)
50
+    (enable-raw-input)
51
+    ;; TODO: The extra keys don't actually work in cl-charms, fix this.
52
+    (enable-extra-keys *standard-window*)
53
     (loop named game-loop
53
     (loop named game-loop
54
-          for char := (get-char *standard-window* :ignore-error t) do
55
-            (refresh-window *standard-window*)
56
-            (handle-input char state)
57
-            (multiple-value-bind (width height) (window-dimensions *standard-window*)
58
-              (setf (game-state-cursor-x state) (mod (game-state-cursor-x state) width))
59
-              (setf (game-state-cursor-y state) (mod (game-state-cursor-y state) height)))
60
-            (move-cursor *standard-window* (game-state-cursor-x state) (game-state-cursor-y state))
61
-          until (game-state-quit? state))))
54
+       for char := (get-char *standard-window* :ignore-error t) do
55
+         (refresh-window *standard-window*)
56
+         (handle-input char state)
57
+         (multiple-value-bind (width height) (window-dimensions *standard-window*)
58
+           (setf (game-state-cursor-x state) (mod (game-state-cursor-x state) width))
59
+           (setf (game-state-cursor-y state) (mod (game-state-cursor-y state) height)))
60
+         (move-cursor *standard-window* (game-state-cursor-x state) (game-state-cursor-y state))
61
+       until (game-state-quit? state)))
62
+  (print (game-state-history state)))
62
 
63
 
63
 (defun start-dev (state)
64
 (defun start-dev (state)
64
   (ql:quickload :slynk)
65
   (ql:quickload :slynk)