Archived

This topic is now archived and is closed to further replies.

Zem

More than 2 keys at once, please!

Recommended Posts

I have noticed that many apps using DirectInput can''t take keep track of any number of keyboard keys at once. As an extreme case, while running a game im making on my friends computer, one could not press more than two keys at once. Sometimes it even starts beeping. Does anyone have any clue to why this is happening? // Zem

Share this post


Link to post
Share on other sites
Actually, that''s not correct - most DirectInput apps do track multiple key-presses since that is the nature of DirectInput. A single call to GetDeviceState reads in the exact state of every key if they are pressed or not.

Read through the samples of the SDK, or in the help - look at IDirectInputDevice::GetDeviceState function. If you need more help, try checking out the Gauntlet Style Project core code that contains full input source code - it''s under the game projects page on this site.

Jim Adams

Share this post


Link to post
Share on other sites
The beeping reminds me of old DOS games. You should never get that in a Win32 program, especially one using DirectInput. The beeping happens when the game is reading input from the keyboard buffer, and the data is coming in faster than the game can handle it.

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.

Share this post


Link to post
Share on other sites
I think the problem lies in the keyboard. On my old keyboard, I could hold down as many keys at once as I could and it never seemed to have any problems, but on this one it only lets me hold down 3 at a time. And the wierd thing is the good keyboard was free, even though it was brand new at Best Buy, and this one was $10 or something. I wish I would''ve grabbed 2 or 3 of those good ones^^



-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)

"I'm dropping like flies!" - me, playing Super Smash Bros. (and losing)
"What fun!" - me, playing Super Smash Bros. (and beating the crap out of somebody)

Share this post


Link to post
Share on other sites
Yes..The keyboard you are using can make a difference!!!

Some keyboards skimp on the electronics and cause a situation where you can only reliably press down some set number of keys before any more will not be recognized.

Often you''ll find keyboards where you can press down many keys but not too many in the same area (say, qweasdzxc), because you''ll overload the ''shared'' switch between those keys.

Its a sad but true fact.

Share this post


Link to post
Share on other sites
"You should never get that in a Win32 program, especially one using DirectInput. The beeping happens when the game is reading input from the keyboard buffer, and the data is coming in faster than the game can handle it.

I knew that beeping was due to the buffer being full - I get it as well, and it makes my program seem really crappy.

Ironblayde - What should one do if they are getting that in a Win32 app, using DirectInput?

Also, is it really the quality of the keyboard, or could it be something to do with the Typematic setting in the BIOS, eg. when the key is held how often per second (or ms?) a signal should be sent?

Paulcoz.

Edited by - paulcoz on October 31, 2000 12:23:38 AM

Share this post


Link to post
Share on other sites