diff options
author | Boutade <thegoofist@protonmail.com> | 2019-10-18 15:13:58 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-10-18 15:13:58 -0500 |
commit | d87366cb875f8f3a0189cafa3f87e1b2bdcaf9d6 (patch) | |
tree | 9b3e506481f18acb23e09854d16696c4b14493b9 /the-price-of-a-cup-of-coffee.lisp | |
parent | d07255239d1d3b202183ec94779a3fd2c5589121 (diff) |
input mode
Diffstat (limited to 'the-price-of-a-cup-of-coffee.lisp')
-rw-r--r-- | the-price-of-a-cup-of-coffee.lisp | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/the-price-of-a-cup-of-coffee.lisp b/the-price-of-a-cup-of-coffee.lisp index 5d2de34..1e8ec2f 100644 --- a/the-price-of-a-cup-of-coffee.lisp +++ b/the-price-of-a-cup-of-coffee.lisp @@ -535,43 +535,47 @@ (defun handle-keydown (keysym) (let ((key (sdl2:scancode-value keysym))) - (match-key key - (:scancode-space (unless (keys-down-action *keys-down*) - (setf (keys-down-action *keys-down*) t) - (action-key-pressed))) + (case *input-mode* + (:normal + (match-key key + (:scancode-space (unless (keys-down-action *keys-down*) + (setf (keys-down-action *keys-down*) t) + (action-key-pressed))) - (:scancode-left (unless (keys-down-left *keys-down*) - (setf (keys-down-left *keys-down*) t) - (add-walk-hero-left))) + (:scancode-left (unless (keys-down-left *keys-down*) + (setf (keys-down-left *keys-down*) t) + (add-walk-hero-left))) - (:scancode-right (unless (keys-down-right *keys-down*) - (setf (keys-down-right *keys-down*) t) - (add-walk-hero-right))) + (:scancode-right (unless (keys-down-right *keys-down*) + (setf (keys-down-right *keys-down*) t) + (add-walk-hero-right))) - (:scancode-up (unless (keys-down-up *keys-down*) - (setf (keys-down-up *keys-down*) t) - (add-walk-hero-up))) + (:scancode-up (unless (keys-down-up *keys-down*) + (setf (keys-down-up *keys-down*) t) + (add-walk-hero-up))) - (:scancode-down (unless (keys-down-down *keys-down*) - (setf (keys-down-down *keys-down*) t) - (add-walk-hero-down)))))) + (:scancode-down (unless (keys-down-down *keys-down*) + (setf (keys-down-down *keys-down*) t) + (add-walk-hero-down)))))))) (defun handle-keyup (keysym) (let ((key (sdl2:scancode-value keysym))) - (match-key key - (:scancode-space (setf (keys-down-action *keys-down*) nil)) - (:scancode-left (setf (keys-down-left *keys-down*) nil) - (rem-walk-hero-left)) + (case *input-mode* + (:normal + (match-key key + (:scancode-space (setf (keys-down-action *keys-down*) nil)) + (:scancode-left (setf (keys-down-left *keys-down*) nil) + (rem-walk-hero-left)) - (:scancode-right (setf (keys-down-right *keys-down*) nil) - (rem-walk-hero-right)) + (:scancode-right (setf (keys-down-right *keys-down*) nil) + (rem-walk-hero-right)) - (:scancode-up (setf (keys-down-up *keys-down*) nil) - (rem-walk-hero-up)) + (:scancode-up (setf (keys-down-up *keys-down*) nil) + (rem-walk-hero-up)) - (:scancode-down (setf (keys-down-down *keys-down*) nil) - (rem-walk-hero-down))))) + (:scancode-down (setf (keys-down-down *keys-down*) nil) + (rem-walk-hero-down))))))) (defun update-tweens (time) (dolist (tween *tweens*) |