Jump to content
  • Advertisement
Sign in to follow this  
p997

[.net] mouse & DirectX.DirectInput

This topic is 4457 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, im trying to incorporate mouse with my game through DirectInput. well, i know how to initialize & poll the device, but how do i get the current cursor x,y position relatively to the screen position. for instance, the screen resolution is 800 x 600, then when the mouse cursor is at upper left corner it should read 0,0 while it should read 800,600 when it is at bottom right corner. Could someone pls tell me how to use the mouse cursor to retrieve the screen position. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Well, the thing about DirectInput is, it doesn't know or care where the mouse is. :) This is fine for games where you use the mouse without a cursor (ie aiming in FPS). This is not fine for places where you need a cursor (ie main menu GUI). So, if you do care about where the mouse is, you have to keep track of it yourself. :)

See these resources for some help on how to accomplish that:

Developing a GUI Using C++ and DirectX
Moving Your Game to Windows, Part II: Mouse and Joystick Input <-- Really old article, so code is pretty useless, but it goes over the concepts.

Hope that helps,
Vovan

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!