Jump to content
  • Advertisement
Sign in to follow this  
MrDoomMaster

DirectInput not working [FIXED]

This topic is 4870 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)
{
    if(!m_Initialized)
        return 0;

    UCHAR KeyMap[256] = {0};

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

    if(KeyMap[VirtualKey] & 0x80)
        return 1;
    else
        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
    if(Input.KeyDown(DIK_ESCAPE))
    {
        PostQuitMessage(0);
    }

    // UP
    if(Input.KeyDown(DIK_UP))
    {
        BlitterLoc.y -= 1;
    }

    // DOWN
    if(Input.KeyDown(DIK_DOWN))
    {
        BlitterLoc.y += 1;
    }

    // LEFT
    if(Input.KeyDown(DIK_LEFT))
    {
        BlitterLoc.x -= 1;
    }

    // RIGHT
    if(Input.KeyDown(DIK_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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!