Skip to main content
GameDev.net gamedev.net
🔒 Locked

Text entry with directinput

Started by johnnyBravo Apr 27, 2004 at 8:46 PM 3 replies 650+ views
Original Post
johnnyBravo
johnnyBravo
Hi, im making a textbox object for my program but when i try use direct input for the key detection, i find it just impossible to get text entry good enough. eg i press a button and it makes like 10. So i put a timer on it but the timer is using timegettime, which is constantly running so you may get the timer during any period. etc etc the problems go on, so im wondering if anyone has been able to use directinput for decent letter entry. Thanks,
arkitek
arkitek
first, look at the DXSDK input wrapper that is used in every example.

second, you can use their wrapper straight up once u understand what it is doing.

third, once you have determined that a key is pressed, you can wait in a loop until the key is released. once it is released, you can write the character to your text box.
Raloth
Raloth
I would recommend just using the standard Windows message queue for text input.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
ms291052
ms291052
quote:
Original post by Raloth
I would recommend just using the standard Windows message queue for text input.



I second that, but arkitek''s method is also good (and probably the best way to do it in DInput)
Mihkael
Mihkael
You really should not use DirectInput. The SDK docs actually recommend not using DirectInput for normal keyboard input. People like me also will cease to hate you (Dvorak users, for that matter, anybody with a non US-Qwerty keyboard mapping). The normal input system handles a lot of stuff automatically for you, such as keyboard locale translation, key repeat rate, etc. I would recommend just UnAcquiring your DIKeyboard, and passing in WM_CHAR messages.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.