Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sprite  (Read 1299 times)

0 Members and 1 Guest are viewing this topic.

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Sprite
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
AW: Sprite
« Reply #1 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. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Sprite
« Reply #2 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Sprite
« Reply #3 on: November 17, 2013, 12:10:52 pm »
Your problem description is very unclear. Please read this thread (especially the part about the minimal complete example) so that we understand you :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Sprite
« Reply #4 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 !

 

anything