Fork me on GitHub
#clojure
<
2018-06-02
>
jco13:06:12

(char 1) ;; => \^A Seems to be the character literal captured by libGDX's keyTyped callback (class: InputProcessor), when I press Ctrl+a. But is there any way to type these literals in Clojure, so I don't have to compare against magic values like 1?

polymeris13:06:02

\u0001, still magic, but at least a literal. Libgdx should be able to capture ctrl and A keypresses separately, which might make more sense if you are writing a game.

👍 4
jco21:06:11

Yes, I went with handling the keyDown/`keyUp` events instead, which lets me get the keys separately.

jco13:06:12

@curlyfry That doesn't mention \^A though?

curlyfry13:06:24

Ah, I see. Haven't come across it before, sorry

Alex Miller (Clojure team)14:06:32

that’s a Unicode char literal

Alex Miller (Clojure team)14:06:41

user=> (= (char 1) \u0001)
true

jco14:06:15

@alexmiller Ah, I see thanks!