SFML community forums
Help => Graphics => Topic started by: Phanoo on August 06, 2012, 12:39:36 pm
-
Hi
I've downloaded the latest SFML2 RC build and I cannot find these useful functions, are they hidden somewhere or temporarily disabled for some reason?
I was a good user of them, I think having "s.SetPosition(s.GetPosition().x,y)" everywhere I need to set only X or Y position of an object is not clean and make the code harder to read (and probably a little bit slower due to the getposition() call)
-
Yes they do not exist anymore as the documentation would also show. The design decision is a good thing though, it keeps the interface clean. If you have to change often the position, it's adivced to use a vecotr to make the position change and then just hand that over to sprite.
About performance you don't need to fear anything. ;)
-
Thank you
For the vector trick, do you mean I have to use a vector to store/modify coordinates, then put "s.setPosition(vector[0],vector[1])" in the main loop ?
-
Hehe, no I was refering to sf::Vector2 which holds the x and y coordinate and every size-function has an argument list for vector so you can just use .setPosition(myVec).
If you don't use already vecotrs for your entities/objects then you maybe need to rethink your design. ;)
-
Agree with eXpl0it3r here. I used to be pretty much seperate X/Y mindset, but vectors are so much cleaner.