SFML community forums
Help => Window => Topic started by: fkrauthan on April 12, 2009, 07:39:01 pm
-
Hello,
how can i change the origin of SFML from the upper left to the lower left like OpenGL Used it nativ?
fkrauthan
-
use SetCenter() (by Center it really means origin).
-
I'am new in SFML i get a View with sf::View& DefaultView = App.GetDefaultView();
ok? Then i set die Center at this View. Must i do somthin after that? Must i set the Center To 0,0 or to Window Height, 0 to have my orign aht the lower left corner?
-
That's not possible at the moment. You have to calculate your coordinates on your own, like:
sf::Vector2f convertToX( const sf::Vector2f &src, const sf::RenderTarget &target ) {
return sf::Vector2f( src.x, target.GetHeight() - src.y );
}
Another possibility is to derive from sf::Sprite and reimplement Move()/SetPosition() etc. to use your own coordinate system.
Maybe you can also use some OpenGL functions to archieve that -- too bad my knowledge isn't that huge in that area. ;)
-
so you convert from OpenGL Coords to top left corner only at the move and setposition function or also at the Render function so that i translate it to my coords and in the render it would trasnlate to your coords? (Speed loos?)
-
Actually, the function to convert coordinates wouldn't be that simple. It would have to take in account the sprite's height and the target view (not the target window).
-
...which keeps the function still simple. :)