Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

theEvent charactersIgnoringModifiers - Get characters without modifiers

Im trying to implement a keyboard class in my game that has two modes. The game mode takes input that uses lowercase, unmodified keys (unmodified meaning if I type a '0' with the shift it still returns '0' instead of ')'). I have tracked it down as far as using the charactersIgnoringModifiers method of the NSEvent class but this method excludes all the modifier keys except for the shift key.

like image 906
Chase Walden Avatar asked Jan 15 '13 19:01

Chase Walden


1 Answers

You can use -[NSEvent keyCode] and then translate the key code to a character without using any modifiers. Doing the latter is easier said than done. Here's a long mailing list thread on the techniques and gotchas.

like image 181
JWWalker Avatar answered Oct 04 '22 21:10

JWWalker