Getting keyboard input w/ DirectX
Alright, I understand DI enough to get input from the keyboard. They press ESC I exit the program. Now I want to make it so the user can type a file name to load and I want to use DI. Now I already know how to check for individual keys, but without checking each key specifically, how could I do this? I''m aiming to do something like cin, but more simple.
thanks in advance
Peon
You''ve gotta make your own function that writes chars to a string every time you press a letter. It''ll take a little typing, buty once yo finish it, the rest will be easy.
-Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."
-Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."
i would just intercept the WM_CHAR message for typing things in - that way you get the keyboard refresh rates (etc) by default.
I think that''s my problem, Forcas. I know how to check keys using an if statement or something, ie:
if (keystate[DIK_A]
{
do...
}
Or whatever. My problem is that I want to get input without going: if (A), if (B), if (C).. You know what I mean? I might just be misunderstanding you, let me know if you have something else in mind
Thanks
Peon
if (keystate[DIK_A]
{
do...
}
Or whatever. My problem is that I want to get input without going: if (A), if (B), if (C).. You know what I mean? I might just be misunderstanding you, let me know if you have something else in mind
Thanks
Peon
You can get DI to Poll/GetDeviceState - which is what you''re probably doing OR you can setup DI for BUFFERED input (which sounds like what you want). Check out the DX-DI function GetDeviceData() or do a search for "Buffered Keyboard Data" in the SDK help files. I think that''s what you''re looking for.
Regards,
Jumpster
Regards,
Jumpster
Sounds like you are going to want to convert DIK codes to ASCII codes. There''s an article here on GameDev about this, in the resources.
Andy.
Andy.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement