KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Games need low-level access to keyboard input. On Windows, there's DirectInput. But what technology do Mac OS X game developers use? Obviously, there's enough Mac games which get keyboard input just right, without the drawbacks of the commonly known solutions: Solution #1: Use keyUp / keyDown events -(void)keyUp:(NSEvent*)event; -(void)keyDown:(NSEvent*)event; Inacceptable drawback: keyDown events are repeated based on the system preference settings for "key repeat rate" and "key repeat delay". This causes an initial keyDown event followed by a pause before it starts repeating at a rate defined by a system preference setting. This solution can not be used for continuous key events. I wonder if the key repeat behavior can be disabled? I suppose that you could read the first keyDown key, then remember the "key with keyCode x is down" state in your class until the keyUp event is received for that key, thus bypassing the repeat delay and repeat rate issues. Solution #2: Use Quarts Event Taps See Quartz Event Services Reference . It seems to be sufficiently low-level. Inacceptable drawback: requires Assistive Devices to be enabled in system preferences under Universal Access - Keyboard. While this may be on by default, there is no guarantee that it might be turned off on some systems. I also read that Quartz event taps require the app to run as root, but found no confirmation for this. Solution #3: <a href="https://stackoverflow.com/questions/5844
Tags (comma-separated)
Save Edits
Cancel