For games, low-level access to the keyboard input is required. Windows has DirectInput. But what technology do Mac OS X game developers use?
Obviously, there are enough Mac games that get keyboard input just to the right, without the disadvantages of well-known solutions:
Solution # 1: Use keyUp / keyDown events
-(void)keyUp:(NSEvent*)event; -(void)keyDown:(NSEvent*)event;
Unacceptable disadvantage: keyDown events are repeated in accordance with the system settings for the "key repetition rate" and "key repetition delay." This triggers the keyDown event, followed by a pause before it starts to repeat at the speed specified by the system settings. This solution cannot be used for continuous key events.
I wonder if it's possible to disable key repetition behavior? I believe that you could read the first KeyDown key, and then remember the "key with keyCode x is down" state in your class until the keyUp event for that key is received, thereby avoiding the problems of delayed repetition and repetition.
Solution # 2: Use Event Briefs for Quarts Projects
See Quartz Event Services It seems quite low.
Unacceptable flaw: it is required that auxiliary devices be included in the system settings in the Universal Access - Keyboard section. Although this can be enabled by default, there is no guarantee that it can be disabled on some systems.
I also read that for short-term Quartz events, the application should be run as root, but no confirmation was found for this.
Solution # 3: Carbon Events / IOKit HID
The Carbon Event Manager Reference is deprecated and should not be used for new development.
Unacceptable flaw: no one knows how long Carbon events will be supported in future versions of Mac OS.
Besides being an outdated base, Carbon seems like the best solution. But are there any other disadvantages to using Carbon Events?
Questions:
What technology do game developers use for Mac OS X to receive input events with low keyboard levels? If they use one of the above technologies, how do they deal with the disadvantages that I mentioned?
UPDATE:
In the end, I switched to using regular NSEvent messages and wrapped them in a neat API for polling keyboard states .