Sign in to follow this  
Vanderry

[DX9] Textual input from keyboard state?

Recommended Posts

Vanderry    252
Hi everyone ! I'm currently working on a GUI for a game engine of mine and it just occurred to me that I don't really know how to extract textual data from the keyboard state array I maintain using GetDeviceState(). Well, I know I could check for "DIK"-macro matches using a big-ass switch, but surely there must be a smoother way? I would very much like to be able to recognize capital letter input (shift-modified) if possible since it is a textbox-like item for inserting character names and the likes. I thought I shouldn't provide any of my source code since it is pretty stupid so far but my idea was to check for keyboard input every time the GUI-component's Update() method is called and if any - add to it's private string both to display while typing and to pass on when the user is done. If anyone might be able to help me solve this I'd be very grateful :)

Share this post


Link to post
Share on other sites
Vanderry    252
Quote:
Original post by SiCrane
Why not just process the WM_CHAR or WM_UNICHAR window messages?


I guess my current Input class might be a bit too simple for this case. It could be extended to read input from there, but does that take into account when a character key is modified by shift?

Edit: As far to my knowledge I would have to check individually for the shift keydown and subtract 32 from the other pressed key, but this would only work in the event of an alphabetical key being pressed.

[Edited by - Vanderry on March 12, 2010 6:51:30 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this