• Advertisement

Archived

This topic is now archived and is closed to further replies.

DirectInput Key bindings

This topic is 6615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just wondering what is the general method to remap keys to work with directinput.

I think it would be something like this no?
dword keys[array of all your key constants];
Then you can later do things like keys[up]=VK_UP;

Or am i way off track here?

Share this post


Link to post
Share on other sites
Advertisement
You actually need a UCHAR keymap[256];
You then set the data format, acquire the keyboard, and then in your main loop get the keyboard key info with a call to IDIRECTINPUTDEVICE2::GetDeviceState();

Once you have that, you can use the keymap variable in an array, like this:

if(keyword[DIK_ESCAPE] & 0x80)
{
// escape is pressed, do something!
}

The DIK_* constants are DirectInput specific, they're not the win32 ones, and are probably explained in the SDK.

I hope this has helped. It is possible that some of the things I said don't make sense, I'm in the middle of my exams and haven't touched my compiler for 2 weeks or so.

------------------
/Alexander Deruwe

Share this post


Link to post
Share on other sites

  • Advertisement