Hello guys, my first post.
I am pretty new in SFML (using 2.0) and I have really basic problem with sprites..
After the problem showed up in big project, I decided to simplify the problem scope to a basic project, and it still doesn't work.
Well, there is my little program:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
sf::Texture texture;
texture.loadFromFile("img1.png");
sf::Sprite sprite;
sprite.setTexture(texture);
sprite.setPosition(200, 300);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(sprite);
window.display();
}
return 0;
}
All i see is black screen..
When I'm using sprite.setTextureRect(sf::IntRect(0, 0, 50, 50)); the known white square appears.
Maybe i didn't save my img1.png at the correct place? it saved in the same directory of this .cpp file.