Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Point position relative to Window  (Read 1700 times)

0 Members and 1 Guest are viewing this topic.

lockandstrike

  • Newbie
  • *
  • Posts: 32
    • View Profile
Point position relative to Window
« 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?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Point position relative to Window
« Reply #1 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
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

lockandstrike

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Point position relative to Window
« Reply #2 on: November 24, 2013, 04:13:58 pm »
Thank you!