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

Author Topic: Screen position transforms  (Read 2581 times)

0 Members and 1 Guest are viewing this topic.

Zoomulator

  • Newbie
  • *
  • Posts: 10
    • View Profile
Screen position transforms
« on: September 12, 2011, 04:37:38 pm »
I figured that the window class could keep two functions for transforming between the screen and the current view setting.
In the case that you set up a view that's not aligned to the pixels of the screen, the window could have a ScreenToView and ViewToScreen transform function so you could easily get the mouse position in the active view.

It's fairly straightforward to do it yourself, but it's easy to get wrong a few times before it's right. Another of those convenience things, but I think it'd make sense with the Window - View feature that's already in.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Screen position transforms
« Reply #1 on: September 12, 2011, 04:47:41 pm »
There's already a window-to-view conversion (ConvertCoords). Would the inverse be useful? Do you have a use case for it?
Laurent Gomila - SFML developer

Zoomulator

  • Newbie
  • *
  • Posts: 10
    • View Profile
Screen position transforms
« Reply #2 on: September 12, 2011, 05:00:44 pm »
Oh, it's in the RenderWindow class! Most weight of my suggestion was on that part...

The inverse would mainly be used for checking pixels, which is hardly ever done now days. It's a lot more complicated with hardware textures and all the rest.

Can't think of any other use for the inverse... nope.

Thanks for pointing me right.

 

anything