Archived

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

PaulSchwarz

Input

Recommended Posts

I have a problem. I''ve written a small program using DirectInput 8. I''ve compiled it and pressed randomly some keys on the keyboard so as to check if the program was working correctly. Unfortunatelly, despite programming some OnAnyKeyPress events the program seemed not to notice that the key had been pressed when I was pressing arrow keys. But when I was pressing some other keys, everything worked smoothly. Simply, I can''t find out in which part of the program''s code I made a mistake, so I cannot provide you any more information about my problem. Yet, if you ever had something similar, post here your message, pls.

Share this post


Link to post
Share on other sites
Some combinations of keypresses just aren''t supported by the hardware. Try the exact same combination in Notepad: if it works in Notepad, you''ve got a bug, otherwise you''ve probably hit a hardware limitation and will have to use fewer keys.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

Share this post


Link to post
Share on other sites
Are you using buffered input? If not, this is the typical problem with Direct Input when not using buffered input. It is possible that you''re application will miss a click or a keypress while it is doing something else, say rendering.

When using buffered input, (GetDeviceData() instead of GetDeviceState()) Direct Input captures everything and holds it in a buffer waiting for you to process it. Buffered data takes a bit more setup to get working properly, but simplifies keyboard management. It makes mouse management a bit more accurate though more complex than non-buffered input.

I''d suggest getting buffered input up and running and if you still have the same problem send me an email. I''ll see if I can help you get it up and running.



Derek Licciardi (Kressilac)
Elysian Productions Inc.

Share this post


Link to post
Share on other sites