Sign in to follow this  

Managed Directinput direction buttons problem

This topic is 3660 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'm using GetCurrentKeyboardState from a Keyboard device. It detects multiple keys down ex State(key.a) State(key.b) State(key.c) could return 3 true's if I had them all pressed, but for the direction keys (up, down, left, right) it only detects the first 2 pressed. Is there a setting at initialization to change this?
    Private Sub InitializeKeyboard()
        I_Keyboard = New Device(SystemGuid.Keyboard)
        I_Keyboard.SetDataFormat(DeviceDataFormat.Keyboard)
        I_Keyboard.SetCooperativeLevel(W_Target, Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Foreground _
            Or Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Exclusive)
        Try

            I_Keyboard.Acquire()
            I_KeyboardAcquired = True
        Catch e As Exception
            I_KeyboardAcquired = False
        End Try
    End Sub

Share this post


Link to post
Share on other sites
I've heard some "cheaper" keyboards are only able to handle a limited number keys down at one time, so it's possible it could be a hardware limitation. If I remeber correctly you can identify this by the way the computer beeps at you when you try to hit too many keys at once.

I'd have to go back and check the documentation but I'm pretty sure there is no setting that has an effect on the number of keys that can be 'pressed' at any one time. The only setting I remeber from the older SDKs was switching between real time keyboard state and cached keyboard state.

Share this post


Link to post
Share on other sites
I don't think it's the keyboard because I can press multiple buttons on any other than the direction buttons, but thanks for the suggestion, I have a usb keyboard I'll try out.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stukey
I don't think it's the keyboard because I can press multiple buttons on any other than the direction buttons, but thanks for the suggestion, I have a usb keyboard I'll try out.


It is very likely to be the keyboard. Do a search here for keyboard and multiple keys. You'll get quite a bit of information. The most common issue with keyboards is the very one you are seeing - no more than two direction keys at one time.

It has to do with the way keyboards are wired and the problem isn't always limited to "cheap" keyboards.

Share this post


Link to post
Share on other sites
So... would the way around this be to just use unmanaged directinput, or windows to detect keys or is it literally hardware to the point where there is no way around this?

*edit* So yeah, I hooked up my other keyboard and it has certain 3 button combinations that work (up,down,right) and (left,right,down) but those are the only 3 button combos that work.

Share this post


Link to post
Share on other sites

This topic is 3660 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this