SFML community forums

Help => General => Topic started by: lockandstrike on November 23, 2013, 11:54:25 pm

Title: Point position relative to Window
Post by: lockandstrike on November 23, 2013, 11:54:25 pm
So I am working with hexagons and the easiest way I found to do this with SFML is set a CircleShape point count to 6. But now I'm implementing a mouse check and I needed the points position but the getPoint() function gives me the position relative to the hexagon bounding rect instead of giving the position relative to the Window. So my question is:

How do I get the point position relative to the window?
Title: Re: Point position relative to Window
Post by: Nexus on November 24, 2013, 10:35:11 am
position of hexagon (bounding rect) + local position of point = global position of point

global position - view position (left-upper corner) = position relative to window
Title: Re: Point position relative to Window
Post by: lockandstrike on November 24, 2013, 04:13:58 pm
Thank you!