Jump to content
  • Advertisement
Sign in to follow this  
wingerx

[.net] object selection with mouse(direct input problem)

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

I searched but I can't find solution so I post here. I m now using directDraw to draw some "sprite", which define in class cell. those sprite will wait for user mouse click. I successfully create the cells and draw them on screen, but fail to response to the mouse click. If I must use directInput to do the mouse event handling on a lot of instance of same class(every instance have ability to know he is selected and give response), what should I do? Can anyone give a solution/tutorial on this?

Share this post


Link to post
Share on other sites
Advertisement
If you are using transformed coordinates, then try using .NET event handlers to perform this action.

Give each sprite a dimension, and have the mouse check within its area, but I assume you already did this - i can give a better algo if you need it however.

If you are using positioned coordinates, then you need to "inverse" the matrices from screen space back into model space.

This is known as "Picking" and toymaker.com has an article on it.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!