|
@@ -38,7 +38,6 @@
|
38
|
38
|
|
39
|
39
|
(defun handle-input (char state)
|
40
|
40
|
(case char
|
41
|
|
- ((nil) nil)
|
42
|
41
|
((#\w) (player-up state))
|
43
|
42
|
((#\s) (player-down state))
|
44
|
43
|
((#\a) (player-left state))
|
|
@@ -48,17 +47,19 @@
|
48
|
47
|
(defun start (&optional (state (make-game-state)))
|
49
|
48
|
(with-curses ()
|
50
|
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
|
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
|
64
|
(defun start-dev (state)
|
64
|
65
|
(ql:quickload :slynk)
|