SFML community forums

Help => Graphics => Topic started by: mihaineken on November 17, 2013, 11:37:08 am

Title: Sprite
Post by: mihaineken on November 17, 2013, 11:37:08 am
So I have my class :

class myClass{
private :
sf::Sprite my_sprite;
public :
void set_position( sf::Vector2f my_vector ) { my_sprite.setPosition( my_vector ); }
}

in main I have :

myClass class ;
sf::Vector2f someVector ;

someVector.x = (float) 50 ;
someVector.y = (float) 100 ;

class.set_position( someVector ) ;   //DOES NOT WORK. WHEN I DRAW THE OBJECT , THE POSITION IS STILL 0, 0
Title: AW: Sprite
Post by: eXpl0it3r on November 17, 2013, 12:04:20 pm
Could make a complete example, the given pieces should set the position of the sprite correctly, but it might not get used right at some other places. :)
Title: Re: Sprite
Post by: mihaineken on November 17, 2013, 12:09:28 pm
the class is in another file.

if I declare in main a sprite and set the position to someVector, it change the position correctly.
Title: Re: Sprite
Post by: Nexus on November 17, 2013, 12:10:52 pm
Your problem description is very unclear. Please read this thread (http://en.sfml-dev.org/forums/index.php?topic=5559.0) (especially the part about the minimal complete example) so that we understand you :)
Title: Re: Sprite
Post by: mihaineken on November 17, 2013, 12:37:46 pm
I don't know what I've done wrong.
I've remade the example with minimum code and it work's fine ...

Thank you guys !