SFML community forums

General => Feature requests => Topic started by: Zoomulator on September 12, 2011, 04:37:38 pm

Title: Screen position transforms
Post by: Zoomulator 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.
Title: Screen position transforms
Post by: Laurent 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?
Title: Screen position transforms
Post by: Zoomulator 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.