Sign in to follow this  
g_WinMain

Need DXInput?

Recommended Posts

g_WinMain    122
Some books about DX said that a game need DXInput to receive the keyboard and mouse messages,but someone told me to use Windows messages such as WM_KEYDOWN WM_LBUTTONDOWN a game need DXInput or not?

Share this post


Link to post
Share on other sites
madRenEGadE    190
you can use DirectInput but nearly everybody say not to use it. Window Messages should be the better way to go (even the DirectX SDK Documentation tells that ^^)

Share this post


Link to post
Share on other sites
sirob    1181
Microsoft documents recommend that you do not use DirectInput for keyboard and mouse input. They still recommend using it for joystick input, though (you don't really have many other choices [smile]).

I've found that DirectInput does actually work well when you need to use relative movement of the mouse. For example, if I were to write an FPS, I'd likely use DInput for the mouse input.
I also like how DInput allows you to easily check if a key is currently down. This is also useful for FPS games (say, to check if the user is currently pressing the forward key).

All in all, IMO the best solution would be using messages for anything that requires a cursor, or for when the user needs to type text into a textbox, and Direct Input for any "real-time" input.

Hope this helps.

Share this post


Link to post
Share on other sites

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