Hi, thanks for your reply,
alright, so I didn't have a mistake thinking, but maybe I should add, that one of the sprites always disappears after the operation. I have a "Mana Bar" with one background sprite and one sprite representing the actual "filling", which changes. This "filling" is the part, which becomes invisible if you will.
This is really, really frustrating me, because I've tried solving this and it simply doesn't work. It's like being stuck behind a huge wall and not being able to reach what you want so much on the other side
I update and render them like so:
void Bar::update()
{
sf::FloatRect gBounds = filling.getGlobalBounds();
filling.setTextureRect( sf::IntRect(
gBounds.left, gBounds.top, step * current, gBounds.height ) );
}
void Bar::render( sf::RenderWindow& window )
{
window.draw( container );
window.draw( filling );
}
Any additional information needed?
greetz
Raincode
EDIT//: To clarify a little:
class Bar
{
public:
Bar( sf::Texture const& container, sf::Texture const& filling, int max );
void update();
void render( sf::RenderWindow& window );
void setPosition( double x, double y );
private:
sf::Sprite container;
sf::Sprite filling;
int max;
int current;
double step;
};
void Bar::setPosition( double x, double y )
{
container.setPosition( x, y );
filling.setPosition( x, y );
}
http://img855.imageshack.us/img855/7606/yid2.png