#include <SFML/Graphics.hpp>
void spriteTexture(sf::Sprite target)
{
sf::IntRect rectangle(0,0,150,238);
sf::Texture image;
image.loadFromFile("image.png", rectangle);
target.setTexture(image);
}
int main()
{
sf::RenderWindow window(sf::VideoMode(1000, 1000), "window", sf::Style::Default);
sf::Sprite sprite;
spriteTexture(sprite);
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;
}