diff options
-rw-r--r-- | scripts/main.scm | 50 | ||||
-rw-r--r-- | scripts/prompt.scm | 2 | ||||
-rw-r--r-- | sources/main.c | 1 | ||||
-rw-r--r-- | sources/repl/repl.c | 0 | ||||
-rw-r--r-- | sources/repl/repl.h | 0 |
5 files changed, 30 insertions, 23 deletions
diff --git a/scripts/main.scm b/scripts/main.scm index af6b550..5dcbe10 100644 --- a/scripts/main.scm +++ b/scripts/main.scm @@ -4,29 +4,37 @@ (load "./scripts/gol.scm") (define camera-offset (make-point)) +(define space-pressed #f) (define (update) - ;; (prompt-update) ;; it's eating the input! - (if (rl-is-key-down KEY_DOWN) - (set! (point-y camera-offset) (+ (point-y camera-offset) 2)) - ) - - (if (rl-is-key-down KEY_UP) - (set! (point-y camera-offset) (+ (point-y camera-offset) -2)) - ) - - (if (rl-is-key-down KEY_LEFT) - (set! (point-x camera-offset) (+ (point-x camera-offset) -2)) - ) - - (if (rl-is-key-down KEY_RIGHT) - (set! (point-x camera-offset) (+ (point-x camera-offset) 2)) - ) - - (if (eq? (rl-get-key-pressed) KEY_SPACE) - (run-step) - ) - + (prompt-update) + + (cond ((not prompt-active) + (if (rl-is-key-down KEY_DOWN) + (set! (point-y camera-offset) (+ (point-y camera-offset) 2)) + ) + + (if (rl-is-key-down KEY_UP) + (set! (point-y camera-offset) (+ (point-y camera-offset) -2)) + ) + + (if (rl-is-key-down KEY_LEFT) + (set! (point-x camera-offset) (+ (point-x camera-offset) -2)) + ) + + (if (rl-is-key-down KEY_RIGHT) + (set! (point-x camera-offset) (+ (point-x camera-offset) 2)) + ) + + (cond ((and (rl-is-key-down KEY_SPACE) (not space-pressed)) + (set! space-pressed #t) + (run-step)) + ) + + (if (not (rl-is-key-down KEY_SPACE)) + (set! space-pressed #f) + ) + )) ) (define (draw) diff --git a/scripts/prompt.scm b/scripts/prompt.scm index f3fe6c9..3440b28 100644 --- a/scripts/prompt.scm +++ b/scripts/prompt.scm @@ -6,7 +6,7 @@ (let ((key-pressed (rl-get-key-pressed))) - (if (or (eq? key-pressed 161) (eq? key-pressed 96)) + (if (eq? key-pressed KEY_F1) (set! prompt-active (not prompt-active)) ) diff --git a/sources/main.c b/sources/main.c index 4f899ce..34f2eda 100644 --- a/sources/main.c +++ b/sources/main.c @@ -11,7 +11,6 @@ #include "rl/core.h" #include "rl/enums.h" #include "rl/shapes.h" -#include "repl/repl.h" #include <math.h> #include <stdio.h> diff --git a/sources/repl/repl.c b/sources/repl/repl.c deleted file mode 100644 index e69de29..0000000 --- a/sources/repl/repl.c +++ /dev/null diff --git a/sources/repl/repl.h b/sources/repl/repl.h deleted file mode 100644 index e69de29..0000000 --- a/sources/repl/repl.h +++ /dev/null |