![]() |
|
Multiple Key Presses - Cocoa Events - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Game Programming Fundamentals (/forum-7.html) +--- Thread: Multiple Key Presses - Cocoa Events (/thread-10133.html) |
Multiple Key Presses - Cocoa Events - JordanReed - Jun 22, 2012 12:54 PM This may be a really simple fix, but I have no idea what I'm doing. I'm trying to use events (with keyDown and keyUp) to get user input, but I can't seem to get more than one key pressed registered at once. I have an array of bool values for each key so I can set the state of each key, but after looking all over the internet it doesn't even look like I can register multiple key presses with keyDown and keyUp. What is a simple way to register keyboard input for a game? Thanks!! RE: Multiple Key Presses - Cocoa Events - OneSadCookie - Jun 22, 2012 02:18 PM You're doing it right! Code: #import <Carbon/Carbon.h> // for kVK_* namesWhat are you doing wrong? Be aware that not *every* set of simultaneous keys will work (hardware limitation). RE: Multiple Key Presses - Cocoa Events - JordanReed - Jun 23, 2012 07:41 AM Oh wow, I think I had my keyDown and keyUp functions all wrong. This is so much better, and now it's working! I was having this problem: http://stackoverflow.com/questions/1151516/multiple-keys-held-down-in-cocoa-os-x my code was very similar to that. Thanks for the help! |