Jump to content
  • Advertisement
Sign in to follow this  
ajeda

[SlimDX] Problem with RawInput and keyboard

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

Hello everybody,

I'm currently working to develop my simple engine using the SlimDX. I implemented RawInput in my InputManager class. Everything works fine, but i have one problem. I've noticed some odd behavior when NumLock is on. When pressing one of the following keys: Up, Down, Left, Right, Insert, Delete, Home, End, PageUp, PageDown - Key property of the KeyboardInputEventArgs object has the same value of 255. Without Numlock on, values of those keys are proper. How can i fix this?

Im registraiting keyboard in following way:
Device.RegisterDevice(UsagePage.Generic, UsageId.Keyboard, DeviceFlags.None);

and input handling:
private void OnKeyboardInput(object sender, KeyboardInputEventArgs e)
{
if (IsEnabled)
{
if (e.State == SlimDX.RawInput.KeyState.Pressed || e.State == SlimDX.RawInput.KeyState.SystemKeyPressed)
{
KeyboardState.SetKeyState(e.Key, KeyState.Down);
}
if (e.State == SlimDX.RawInput.KeyState.Released || e.State == SlimDX.RawInput.KeyState.SystemKeyReleased)
{
KeyboardState.SetKeyState(e.Key, KeyState.Up);
}
}
}

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!