PDA

View Full Version : Directinput and text input, the best way ?



Lowercase
09-11-2008, 05:02 PM
Hello All !

Well, another boring question...

Directinput is a great way to handle user input, but when it comes to handle text input it's not as simple as it seems

Do I need to translate DIK keys in char ?

or use WM_CHAR message in my window message handlin procedure ?

If you have some tricks, please let me know...

many thanks

chronozphere
09-11-2008, 06:27 PM
I suggest you use WM_CHAR as it is far easier, and because Directinput indirectly uses WM_CHAR anyway (AFAIK). By using WM_CHAR, you can save yourself the troubles of writing a system that converts Directinput keystate data to KeyPress/KeyRelease events. Moreover you need your program to resend these messages when the user holds a character key (so he can type "aaaaaa", by holding 'a'). By using WM_CHAR you get all this functionality anyway and as far as i can tell, there are no drawbacks. :)

Check this link for reasons not to use Directinput for keyboard and mouse.

http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=300672&reply_id=3074105

Lowercase
13-11-2008, 09:47 PM
thanks for the advice !

I'm already facing problems, since I thought i could handle user input with a queue... i don't have the results i expected..