• Advertisement

Archived

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

DirectInput: DIK_UP/LEFT/RIGHT/DOWN don't work!!

This topic is 5314 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

I can use all the DIK_ letter keys, and ESCAPE, and TAB, but no arrow keys. Any idea why? If I had a section which testing a keydown using DIK_A, it would work, but if I changed it to DIK_LEFT, it wouldn''t work. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
The way you should use them is something like this, i've been using Direct Input in this way, and it works fine


#define KEYDOWN(name, key) (name[key] & 0x80)

void MyGame::ProcessKeyboard()
{
char KeyboardState[256]={0};

if( FAILED(m_Input.getKeyboardData((LPVOID)&KeyboardState)) )
{
handleError();
}

if(KEYDOWN(KeyboardState, DIK_RIGHT))
DoSomethingOnRight();

if(KEYDOWN(KeyboardState, DIK_LEFT))
DoSomethingOnLeft();

if(KEYDOWN(KeyboardState, DIK_UP))
DoSomethingOnUp();

if(KEYDOWN(KeyboardState, DIK_DOWN))
DoSomethingOnDown();
}

You should also take a look at the SDK's documentation


[edited by - j_vitel on October 7, 2003 12:27:24 AM]

[edited by - j_vitel on October 7, 2003 12:28:41 AM]

Share this post


Link to post
Share on other sites

  • Advertisement