Using direct input, how do I know in wich order the keys are pressed? I need it to implement a console.
Posted on 2001-10-19 18:43:10 by dxantos
Keep an old keboard status. Then compare new keyboard status with the old status. What is diffrent is what keys are pressed now... do this read of keyboard status pretty fast (on a separated thread if possible)

in games is usually good to be able to have 2-3 key pressed at the same time...but no more because keyboard hardware can be overrun :)
Posted on 2001-10-22 13:10:35 by BogdanOntanu

What is diffrent is what keys are pressed now...

hmm? What if a key was pressed when he got the first status, and
released on the next? Then he *should* get a difference, but I wouldn't
say that the key was pressed?

Also, your method allows to see the current pressed keys, but does
it tell the *order* the keys arrive in?
Posted on 2001-10-22 17:22:31 by f0dder
If he does the read fast enough, (thats the whole ideea behind DirectInput ...speed...is it not?) he will read keys faster than the user is able to press them ... so he will get the order also ...

Of course a test for key up/key down will be required ... when i told him to do the difference i was not thinking arithmetic difference... just logic :)

if we assume a 20-30fps game it will read the keys in much faster then the user is able to press them ...
Posted on 2001-10-23 14:10:13 by BogdanOntanu