I know that keyboard events in Mac apps can be triggered like so:
- (void) keyDown(NSEvent*)event {
switch ([event keyCode]) {
case someKeyCode:
NSLog(@"blah blah blah");
default:
break;
}
}
But how would I make my app react to a combination of key pressed, such as the Konami Code?
Thanks!
you will need to build a history list that keeps track of the keys that were pressed over the past however long. and when the list of keys contains a match for your “Code” whether it be the konami code or otherwise. Your match triggers another event and clears the key history.
add the data to an array via strings for control keys
then you can test like this
hope that helps