Jump to content
  • Advertisement
Sign in to follow this  
qorthos

[Slimdx] Rawinput Not Notifying When A Key State Becomes Up

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

Okay, so this one is probably fairly simple, and hopefully it's just me not using RawInput for the keyboard correctly (incidentally, it's working just fine for the mouse).

 

This is my code:

        public override void Initialize()
        {
            Device.RegisterDevice(UsagePage.Generic, UsageId.Keyboard, DeviceFlags.None);
            Device.RegisterDevice(UsagePage.Generic, UsageId.Mouse, DeviceFlags.None);

            SlimDX.RawInput.Device.KeyboardInput += Device_KeyboardInput;
            SlimDX.RawInput.Device.MouseInput += Device_MouseInput;
            
            base.Initialize();
        }

        private void Device_KeyboardInput(object sender, KeyboardInputEventArgs e)
        {
            keysThisFrame.Add(e.Key);
            keyStateChanged = true;
            
            if (e.State != KeyState.Pressed)
            {
                return;
            }
        }

I put a break point inside the if statement for the KeyState.  It never gets called.  I can press buttons all I like, but I will only ever get KeyState.Pressed.  It never tells me when a key is released.  I need that information.

 

Any ideas?

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.

GameDev.net 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!