2+ keys down? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: 2+ keys down? (/thread-7023.html)
2+ keys down? - Fenris - Jun 11, 2003 08:14 AM
I was just wondering - how the heck do you do this? I use GetKeys for input into my Carbon-based application, and I just noticed that GetKeys only supports 2 (or was it three) keys down simultaneously. I know that most of the games out there do support that, I thought I'd ask you how you do it. For instance, I need people to be able to jump and hold the jump button, push left to run left while mid-air, but now that means that I can't shoot! Bad.
2+ keys down? - jSTIN - Jun 11, 2003 08:26 AM
In my carbon game I use this code to do keys.
On the GetNextEvent you might want to mask the events only to key events. To get modifier keys you need add something to it.
This stuff works good for me.
2+ keys down? - NCarter - Jun 11, 2003 11:44 AM
GetKeys() supports as many keys simultaneously as your keyboard hardware. On recent keyboards you can often detect five or six non-modifier keys at once, but since certain keys block certain other keys you might have as few as two. Which keys affect which depends on the keyboard matrix layout.
Modifiers (command, option, shift, control and caps lock) aren't affected by this limitation, so they're good candidates for keys that you never want to fail (fire buttons, for example).
You could switch to an event based mechanism to try to avoid these problems, but I personally have never had any real trouble with GetKeys().