Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
Selecting tile with mouse on an isometric map
Print
Pages: [
1
]
Author
Topic: Selecting tile with mouse on an isometric map (Read 2331 times)
0 Members and 1 Guest are viewing this topic.
Futochu
Newbie
Posts: 7
Now with 50% more gelatin
Selecting tile with mouse on an isometric map
«
on:
February 10, 2015, 07:14:48 am »
Is there an accepted way of determining the tile your mouse cursor is hovering over in an isometric map with varying heights? It's trivial to map the position of a mouse cursor to a tile if all heights were zero, but I can't for the life of me figure out how to get a tile that has an unknown height. This is what my map currently looks like (excuse the placeholder graphics).
http://i.imgur.com/nOLvK37.png
I've read about things such as image maps to determine relative positions, but does this work when heights can vary by +/- 512?
Thanks.
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11034
Re: Selecting tile with mouse on an isometric map
«
Reply #1 on:
February 10, 2015, 08:48:45 am »
Well you're drawing tiles somehow and when drawing you have to know their position, as such it shouldn't be hard to map the mouse's position to the tile position.
A useful function for you might also be: window.mapPixelToCoords()
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Futochu
Newbie
Posts: 7
Now with 50% more gelatin
Re: Selecting tile with mouse on an isometric map
«
Reply #2 on:
February 10, 2015, 09:20:00 am »
I was afraid that would be the best answer. Thanks though
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
Selecting tile with mouse on an isometric map
anything