summaryrefslogtreecommitdiff
path: root/scripts/prompt.scm
diff options
context:
space:
mode:
authorhenriquelalves <henriquelalves@gmail.com>2024-05-26 14:39:55 +0300
committerhenriquelalves <henriquelalves@gmail.com>2024-05-26 14:39:55 +0300
commit56a3d75bbbd80512f76817a05eebaabdcaf37ae2 (patch)
treef6e3b87c484ebe3df51d6e43d9e76b4ded9efb01 /scripts/prompt.scm
parent0a89a84956311f17648bb443e429dab25d35f0cc (diff)
downloadgamejam-slgj-2024-56a3d75bbbd80512f76817a05eebaabdcaf37ae2.tar.gz
gamejam-slgj-2024-56a3d75bbbd80512f76817a05eebaabdcaf37ae2.tar.bz2
gamejam-slgj-2024-56a3d75bbbd80512f76817a05eebaabdcaf37ae2.zip
Update for SLGJ 2024
Diffstat (limited to 'scripts/prompt.scm')
-rw-r--r--scripts/prompt.scm53
1 files changed, 25 insertions, 28 deletions
diff --git a/scripts/prompt.scm b/scripts/prompt.scm
index 3440b28..32e7606 100644
--- a/scripts/prompt.scm
+++ b/scripts/prompt.scm
@@ -3,35 +3,32 @@
(define prompt-text "")
(define (prompt-update)
- (let ((key-pressed (rl-get-key-pressed)))
-
-
- (if (eq? key-pressed KEY_F1)
- (set! prompt-active (not prompt-active))
- )
-
- (if prompt-active
- (begin
- (let ((key (rl-get-char-pressed)))
- (cond ((and (>= key 32) (<= key 125))
- (set! prompt-text
- (string-append prompt-text (string (integer->char key)))))
- ))
-
- (if (rl-is-key-down KEY_ENTER)
- (begin
- (eval-string prompt-text)
- (set! prompt-text "")
+ (if (eq? current-pressed-key KEY_F1)
+ (set! prompt-active (not prompt-active))
+ )
+
+ (if prompt-active
+ (begin
+ (let ((key (rl-get-char-pressed)))
+ (cond ((and (>= key 32) (<= key 125))
+ (set! prompt-text
+ (string-append prompt-text (string (integer->char key)))))
))
-
- (if (eq? key-pressed KEY_BACKSPACE)
- (let ((n (string-length prompt-text)))
- (cond ((>= n 1)
- (set! prompt-text (substring prompt-text 0 (- n 1))))
- )))
-
- ))
- )
+
+ (if (rl-is-key-down KEY_ENTER)
+ (begin
+ (eval-string prompt-text)
+ (set! prompt-text "")
+ ))
+
+ (if (eq? current-pressed-key KEY_BACKSPACE)
+ (let ((n (string-length prompt-text)))
+ (cond ((>= n 1)
+ (set! prompt-text (substring prompt-text 0 (- n 1))))
+ )))
+
+ ))
+
)
(define (prompt-draw)