#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
RenderWindow window(VideoMode(700,700), "Test");
Image heroimage;
heroimage.loadFromFile("images\hero.png");
Texture herotexture;
herotexture.loadFromImage(heroimage);
Sprite herosprite;
herosprite.setTexture(herotexture);
herosprite.setPosition(50, 25);
while (window.isOpen()){
Event event;
while (window.pollEvent(event)) {
if (event.type == Event::Closed)
window.close();
}
window.clear();
window.draw(herosprite);
window.display();
}
return 0;
}
Image heroimage;
if (!heroimage.loadFromFile("images\hero.png")) {
std::cerr << "error while loading the texture";
}