directinput problem
I have a "spaceship" that can accelerate, turn, and shoot in a 2D field. I'm using DirectInput to process these commands. Problem: when I'm turning left(DIK_LEFT) and accelerating (DIK_SPACE), I am unable to shoot (DIK_F). Similarly, when I'm shooting and accelerating, I am unable to turn left. I ONLY observe this problem when using DIK_LEFT. If I use, for example, DIK_A instead, there is no problem. And when I use DIK_RIGHT in any combination with DIK_SPACE and DIK_F there is no problem. Am I missing something here? Is there something special about DIK_LEFT?
Using DirectInput for mouse or keyboard input is a horrific idea. You might as well try to use BIOS interupts to read keyboard input.
Window messages are faster (DirectInput just creates another thread to read window messages)
Window messages give you things like key repeat for free, DirectInput doesn't (Which I think is the problem you're seeing)
Window messages handle shifted letters and caps/num/scroll lock properly, DirectInput doesn't
Window message obey the users control pannel settings, DirectInput does not
Window messages are "free". They get sent to your window without you having to write pages and pages of code to initialise a DirectInput device
Microsoft recommend that you do not use DierctInput for keyboard or mouse input:
As for the actual question, it sounds like a hardware problem. Keyboards can only register a few keys being pressed at any one time, and the way keyboards are made, different key combinations can work where others don't.
Try some other key combinations, and also try using those keys in another game and see if they work there.
Quote:Overall, using DirectInput offers no advantages when reading data from mouse or keyboard devices, and the use of DirectInput in these scenarios is discouraged.
As for the actual question, it sounds like a hardware problem. Keyboards can only register a few keys being pressed at any one time, and the way keyboards are made, different key combinations can work where others don't.
Try some other key combinations, and also try using those keys in another game and see if they work there.
Wow. And I purposely went out of my way to implement directinput because I read that it's faster according to "Advanced 3D Game Programming with DirectX." As you pointed out, though, MSDN clearly states otherwise. Oh well, I still plan to support gamepads with directinput, so all is not lost.
"it sounds like a hardware problem."
Yes, after some experimentation, I am convinced that I have a hardware problem also. The "F", space, and left arrow keys on my keyboard just do not cooperate.
Thanks a lot for the reply, and especially for that directinput revelation!
"it sounds like a hardware problem."
Yes, after some experimentation, I am convinced that I have a hardware problem also. The "F", space, and left arrow keys on my keyboard just do not cooperate.
Thanks a lot for the reply, and especially for that directinput revelation!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement