keyboard doesn't detect SPACE and LEFT at same time
On a certain computer running Vista, my game doesn't pick up the the LEFT key when SPACE is already being pressed.
Is this because I'm using DirectInput for KB, or is there something else I need to fix?
Thanks!
My Vista based computer has no problem detecting both space and left simultaneously, in your game. There is probably little you can do other than make the game controls user configurable and have the user setup the controls to something that works better.
[Edited by - Mastaba on July 9, 2007 4:42:16 PM]
[Edited by - Mastaba on July 9, 2007 4:42:16 PM]
Have a look at this topic and the several links provided therein.
[Edited by - Dave Hunt on July 9, 2007 2:22:43 PM]
[Edited by - Dave Hunt on July 9, 2007 2:22:43 PM]
If you're seeing this issue with only two keys, then you either have the cheapest and worst-engineered keyboard known to man, or your problem is not electrical.
For keyboard input, there are few reasons to use DInput, and many reasons not to. If I were you, I'd switch to window messages.
For keyboard input, there are few reasons to use DInput, and many reasons not to. If I were you, I'd switch to window messages.
Quote:Original post by synth_catOnly if it's due to your code (Which is doubtful if it only occurs with these two keys).
What are the reasons? Is it still possible that this problem is because of using DInput?
Are other games able to detect Left and Space at the same time? If not, it may well be electrical.
Reasons against using DirectInput for keyboard input:
Overall, there's no real reason to use DirectInput for keyboard input over GetAsyncKeyState() or window messages (Because you're pumping all your window messages each frame anyway, right?). Personally, I just have an array of 256 entries, and update them according to WM_KEYDOWN and WM_KEYUP messages. For GUI-style text, I use the WM_CHAR message.
The above points also go for using DirectInput for mouse input too. DirectInput is only really suited for joystick input (And XInput for the Xbox 360 controller).
I remember that GetAsyncKeyState was kind of unresponsive and slow. Does using WM_KEYDOWN and WM_KEYUP have the same problem?
Also, I have to ask: Should I really go to all the trouble of tearing out the DirectInput architecture I already have when my game seems to be working completely fine with Dinput for keyboard already?
(If I were to switch to VK codes, I would have to go write a new huge switch statement for code-to-string conversion, which would be unpleasant.)
Also, I have to ask: Should I really go to all the trouble of tearing out the DirectInput architecture I already have when my game seems to be working completely fine with Dinput for keyboard already?
(If I were to switch to VK codes, I would have to go write a new huge switch statement for code-to-string conversion, which would be unpleasant.)
Quote:Original post by synth_catI have never experienced issues with DI but when I switched to WM, I observed no real difference. At very low FPS the WM approach seemed more robust nut there's little I care for at 10fps.
I remember that GetAsyncKeyState was kind of unresponsive and slow. Does using WM_KEYDOWN and WM_KEYUP have the same problem?
Quote:Original post by synth_catYes, absolutely! I did this, as many others and the benefit from having an unified system gave me a real benefit in the form of less code to manage and simplier code!
Also, I have to ask: Should I really go to all the trouble of tearing out the DirectInput architecture I already have when my game seems to be working completely fine with Dinput for keyboard already?
Quote:Original post by synth_catNot necessarily! There's a Win32 function which does this in a language-dependant way so it gets automatically localized!
(If I were to switch to VK codes, I would have to go write a new huge switch statement for code-to-string conversion, which would be unpleasant.)
If memory serves it's called GetKeyName.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement