Jump to content
  • Advertisement

Archived

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

cyex

High level mouse programming

This topic is 6039 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! I have had many troubles getting DirectInput to work, and I was wondering if there were any quick alternatives for getting mouse input. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Hmm, DirectInput is perhaps the most straight forward DirectX API to use, I find.

What are you having problems with? Initializing the mouse object? Or actually coding the mouses behaviour? The initialization is fairly straight forward, I can cut and paste some code from one of my programs, and you can just shove it into your directinput Init code and be straight off.

If it is the actual coding for the mouses behaviour, well that is really program specific, but it isn''t tough. Tell us exactly what the problem is and I am sure we can help you out.

Share this post


Link to post
Share on other sites
In your Window procedure, the following messages could be of interest:

  
// mouse was moved - get position

case WM_MOUSEMOVE:
mouseX = GET_X_LPARAM(lParam);
mouseY = GET_Y_LPARAM(lParam);
return 0;

// a mouse button was pressed or released

case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONUP:



Not quite as good or efficient as properly written DInput, but if you''re after a quick solution...

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thanks guys... it is the actual initialisation I''m having problems with. It happens with every API I try to start using. (just a really dodgy setup of MS C++) Way too many errors to mention at the moment, but I''ll try to go the way of DInput when I have more time.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!