Advertisement Jump to content
Sign in to follow this  

DirectInput not working [FIXED]

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

First of all, let me show you this function:
int CInput::KeyDown(UCHAR VirtualKey)
        return 0;

    UCHAR KeyMap[256] = {0};

    if(m_Keyboard->GetDeviceState(256, (LPVOID)KeyMap) != DI_OK)
        return 0;

    if(KeyMap[VirtualKey] & 0x80)
        return 1;
        return 0;
This function allows me to submit a key, such as DIK_ESCAPE, and it will return 1 if the key is down, or 0 if the key is not down. For some reason the only time this function will return 1 is when I push ESCAPE. Here is some code that I have tested with:
    // ESCAPE

    // UP
        BlitterLoc.y -= 1;

    // DOWN
        BlitterLoc.y += 1;

    // LEFT
        BlitterLoc.x -= 1;

    // RIGHT
        BlitterLoc.x += 1;
I have placed break points within each of the conditional statements, except for DIK_ESCAPE, which obviously closes the application when it is pressed. The others, however, do not break when I push the arrow keys. Why would escape work but not the others? The function I use to initialize the keyboard device, acquire, etc, doesn't fail. I would appreciate any help. Also something noticable is how when my Direct3D application starts, the cursor is a timer (that sand timer thing) instead of an arrow. Also sometimes the application fails to receive input at all and is basically frozen it seems. Hard to tell though. I'm currently building a library for Direct3D to do basic DirectDraw stuff (2D). My application does nothing but clear the screen (fullscreen, not window mode) black, blitter a bitmap, and then flip the chain. It does this every frame. [Edited by - MrDoomMaster on June 20, 2005 9:49:54 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!