Reputation: 1
Whenever I try to draw an SFML sprite with a negative position, the sprite will not be drawn to the screen. I have tried with and without a view applied to the window, but the sprite is not rendered either time.
I have a sprite with a texture on it (size 32*64). I try drawing in at position (-1,-1) but it will not work. Is this intentional behaviour. If so how would I go about drawing sprites with negative positions. thanks
Upvotes: 0
Views: 100
Reputation: 11
sf::Texture texture;
if (!texture.loadFromFile("texture.png")) {
std::cout << "Error rendering Object";
return 0;
}
sf::Sprite Sprite;
Sprite.setTexture(texture);
Sprite.setPosition(sf::Vector2f(-5, -5));
And draw sprite > window.draw(Sprite);
Upvotes: 1
Reputation: 1
Turns out that I had some confusing mix-ups with signed and unsigned ints. This caused the sprites to be unable to be drawn in negative positions. Please check signed-unsigned types if this error occured for you.
Upvotes: 0