SFML community forums

Help => Graphics => Topic started by: Phanoo on August 06, 2012, 12:39:36 pm

Title: [SFML2] SetX/SetY disappeared ?
Post 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)
Title: Re: [SFML2] SetX/SetY disappeared ?
Post by: eXpl0it3r on August 06, 2012, 12:45:39 pm
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. ;)
Title: Re: [SFML2] SetX/SetY disappeared ?
Post by: Phanoo on August 06, 2012, 01:07:57 pm
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 ?
Title: Re: [SFML2] SetX/SetY disappeared ?
Post by: eXpl0it3r on August 06, 2012, 01:32:58 pm
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. ;)
Title: Re: [SFML2] SetX/SetY disappeared ?
Post by: Jove on August 06, 2012, 04:20:52 pm
Agree with eXpl0it3r here. I used to be pretty much seperate X/Y mindset, but vectors are so much cleaner.