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

Author Topic: [Solved] resizing window throws off mouse coords  (Read 5662 times)

0 Members and 2 Guests are viewing this topic.

internofdeath

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
[Solved] resizing window throws off mouse coords
« on: August 15, 2013, 06:33:35 pm »
When I try to get the mouse coordinates local to my sf.RenderWindow using sf.Mouse.get_position(window), it behaves fine until the window is resized.
« Last Edit: October 29, 2013, 02:41:11 am by Sonkun »

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: resizing window throws off mouse coords
« Reply #1 on: August 15, 2013, 07:53:54 pm »
The window is resized so the view pixel doesn't correspond to real pixels anymore. (unless you also resize the view)
You have to use mapPixelToCoords (it's a RenderWindow method), take a look at the last paragraph of the view tutorial. (or the doc, if there isn't any python tutorial (I have no idea))
« Last Edit: August 15, 2013, 07:55:56 pm by G. »

 

anything