there are of course several solutions to this.
personally, in one of my last projects i created a class 'ttile' and stored the coordinates in it (very useful if you haven't rects as tiles) and with this very helpful function i tested if my mouse was in a tile:
http://swissdelphicenter.ch/de/showcode.php?id=1778
so the used code lookes something like this:
Code:
point.x:= mousex;
point.y:= mousey;
for i:= low(tiles) to high(tiles) do begin
if PtInRgn(tiles[i].poly, point) then begin
//tile[i] is hovered
//do the hovering thing
break;
end;
end;
i'm quite sure it's not the fastest way to do that but it's quite simple and effective.
Bookmarks