From d87366cb875f8f3a0189cafa3f87e1b2bdcaf9d6 Mon Sep 17 00:00:00 2001 From: Boutade Date: Fri, 18 Oct 2019 15:13:58 -0500 Subject: input mode --- the-price-of-a-cup-of-coffee.lisp | 56 +++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'the-price-of-a-cup-of-coffee.lisp') 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*) -- cgit v1.2.3