Skip over non-existent rows when moving in gui.

This commit is contained in:
Phil Hagelberg 2020-03-23 19:02:03 -07:00
parent 8951819d18
commit 22010bb6df
1 changed files with 6 additions and 1 deletions

View File

@ -254,9 +254,14 @@
(send dia show #f))])
(send dia show #t)))
(define (non-existent-key? row col)
(and (< row 2) (or (= col 5) (= col 6))))
(define (move st dx dy)
(set-state-row! st (modulo (+ dy (state-row st)) rows))
(set-state-col! st (modulo (+ dx (state-col st)) cols)))
(set-state-col! st (modulo (+ dx (state-col st)) cols))
(when (non-existent-key? (state-row st) (state-col st))
(move st dx dy)))
(define (change-layer st dir)
(set-state-layer! st (modulo (+ dir (state-layer st))