Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Get absolute coordinates with DirectInput

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

Does anyone know how to use DirectInput to return absolute coordinated instead of relative coordinates as i am creating a program and i need the coordinates to test whether a region has been clicked.there is an example shown in "Windows Game Programming for dummies",but i can''t seem to find out which line of code does the trick.Could it be a version problem as i am using DX8 and the book uses DX6,thanx

Share this post

Link to post
Share on other sites
From the DX8 help file:

"To set the axis mode to absolute, call IDirectInputDevice8::SetProperty with the DIPROP_AXISMODE value in the rguidProp parameter and with DIPROPAXISMODE_ABS in the dwData member of the DIPROPDWORD structure."

This will not give you screen co-ordinates. It will give you an absolute position based on the position the mouse was in when the device was created by DirectInput. Therefore, you may want to use the Win32 mouse messages to get the initial position when the device is created and then use DirectInput from there.


John Reynolds
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
I''d consider using the win32 GetCursorPos function. It does what you want and it''s easy.

I was in the same spot as you and gave it a try - it was the goods.

El Duderino

Share this post

Link to post
Share on other sites

  • 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!