Getting keyboard "key events"
Posted: Sun Jun 22, 2014 6:51 pm
For a simple "game" (console based) I need to get the keyboard "key events" from my Mac.
(read-key) seems to be a good choice, but unfortunately some keys (or modified keys: shift, ..) do require following (read-key)s.
Worse on Mac is that "cursor up" results in three (read-key)s returning: 27 91 65 and ESC in 27! So I can not distinguish between ESC and cursor keys.
Is there a better solution?
Stefan
ps From the newLISP docu: (while (!= (set 'c (read-key)) 1) (println c))
(read-key) seems to be a good choice, but unfortunately some keys (or modified keys: shift, ..) do require following (read-key)s.
Worse on Mac is that "cursor up" results in three (read-key)s returning: 27 91 65 and ESC in 27! So I can not distinguish between ESC and cursor keys.
Is there a better solution?
Stefan
ps From the newLISP docu: (while (!= (set 'c (read-key)) 1) (println c))