Jump to content
  • Advertisement
Sign in to follow this  
nint22

Direct Input / Win32 Window features

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

This is a simple question about directX/win32 input: In my application (C/C++), I acquire the mouse device with direct input in exclusive mode. Yet, I still want the user to be able to move their cursor outside of the window application. The idea is they don't see their cursor in the application's client window (I draw my own) but as soon as they leave the space to do things like maximize, minimize, move the window, restore, whatever... the normal windows cursor apears again at the right location. I hope this explanation makes sense. What I am really asking is how can I use direct input to get the mouse position (relative to the client window) without being in exclusive mode using direct input. Or is there a better way? Any help, as always, is greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You're probably not going to like my suggestion, but I think its the best one: don't use DirectInput for mouse input. With regular Win32 messages, you'll be able show/hide the cursor however you want with no restrictions while still utilizing the regular GUI cursor. If ever need to switch to high-resolution input (perhaps for an FPS camera), you can use RawInput to get the data. DI really offers no advantages at all, and is in fact harder to setup/use. It also creates some extra overhead, since all it does is create a thread to read WM_INPUT messages. Your input system can be much more robust if you simply handle the messages yourself.

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.

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!