SFML community forums

General => Feature requests => Topic started by: Ich1994 on August 14, 2012, 03:21:54 am

Title: sf::View.get/setCoordinates()
Post by: Ich1994 on August 14, 2012, 03:21:54 am
I would like to have the above mentioned methods.

It does not look good if i have to write something like this:
sf::Vector2i Coord=sf::Vector2i(myView.getCenter().x-myView.getSize().x/2,myView.getCenter().y-myView.getSize().y/2);
everytime i need to set or get the Top-Left Coordinates
Title: Re: sf::View.get/setCoordinates()
Post by: Laurent on August 14, 2012, 08:18:06 am
And why not:
sf::Vector2f Coord = myView.getCenter() - myView.getSize() / 2.f;
?

The origin of views is their center point. That's the most intuitive solution for 90% of use cases, so I won't change it just for you ;)
Title: Re: sf::View.get/setCoordinates()
Post by: Nexus on August 14, 2012, 08:23:31 am
If you write the same code again and again, you have not understood an important point in programming. Write a global function that takes a view and returns its top-left coordinates.
Title: Re: sf::View.get/setCoordinates()
Post by: Ich1994 on August 14, 2012, 06:12:27 pm
And why not:
sf::Vector2f Coord = myView.getCenter() - myView.getSize() / 2.f;
?

Because i am new to SFML :D