Advertisement

Best way to find out where the mouse is pointing?

Started by August 17, 2000 09:04 AM
3 comments, last by epic709 24 years, 3 months ago
hello, i''ve got a-sort-of-an-iso-engine up and running with a custom mouse cursor and all and now''s the hard part. How do I determine which tile was clicked on? do I use the absolute coordinates in the DirectInputDevice data buffer and calculate how far the click occurred from the upper left corner (and then make the calculations to turn that info into how many tiles am I from upper left)? or is there a more elegant way (i''m sure there must be) to get the same results? how about an OO way of doing things? like having each tile be an instance of a more generic tile class and having X and Y attributes? plus every tile needs to respond to the click event somehow? anyway, that comes around to 1600 instances in my map and I''m worried about performance if I take this route. doing this doesn''t really seem practical at this point..... the X and Y is also a bit tricky ''coz there''s your normal cartesian X and Y and then there''s the one-of-it''s-kind iso X and Y. anybody have any experience mapping one to another? it''s hard to explain my engine''s workings from scratch so I''ll leave it here for you guys to look at. NOTE: compile in a DEBUG configuration. the whole thing goes bonkers in RELEASE - try it out to see what I mean.
Greetings,
Tanstaafl has a really nice tutorial at:

http://www.gamedev.net/reference/articles/article747.asp

Your question is addressed near the bottom of the page.

Later,
Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

Advertisement
thanks for the tip. I actually read that article 4-months back and totally forgot about it. back to coding then.....
the link given not worked...
Works fine for me. Did you try copying it to your address bar and hit the Go button? (Or whatever Netscape uses.)

GDNet+. It's only $5 a month. You know you want it.

This topic is closed to new replies.

Advertisement