Jump to content
  • Advertisement
Sign in to follow this  
Cosmy

DInput, XInput & WM_CHAR

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

Hi all,

I can mix DInput & WM_CHAR and XInput?
In fact, i want to use dinput for managing mouse and joystick (with xinput), but keyboard in dinput isn't a great idea because you have to translate the scancode to ascii...
Someone have some suggestions?

Share this post


Link to post
Share on other sites
Advertisement

Hi all,

I can mix DInput & WM_CHAR and XInput?
In fact, i want to use dinput for managing mouse and joystick (with xinput), but keyboard in dinput isn't a great idea because you have to translate the scancode to ascii...
Someone have some suggestions?



I don't know about XInput, but you can mix DirectInput and WM_CHAR, at least as long as your cooperative level isn't set to exclusive (I think).

In your main windows message procedure, just add a case for WM_CHAR. wParam will equal whatever key was pressed. Its pretty simple really, if you want to see if SHIFT + F was pressed you just check:
if (wParam == 'F') //switch to fullscreen or whatever

I don't know how you're using DInput for keyboard input, but in my programs I just use the DIK_* defines to check for keydowns. Checking for SHIFT + F might look like this:

if ((keys[DIK_LSHIFT] & 0x80) && (keys[DIK_F] & 0x80))
//do whatever


Hope that helps.

Share this post


Link to post
Share on other sites
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!