yes, like there. but several images are shown at once not one.
#include <SFML/Graphics.hpp>
int main(void)
{
sf::RenderWindow game(sf::VideoMode(256, 224, 32), "Game");
sf::Event event;
sf::Texture texture;
texture.LoadFromFile("myimage.png");
sf::Sprite sprite;
sprite.SetTexture(texture, false);
sprite.SetSubRect(sf::IntRect(0, 0, 16, 16));
while(game.IsOpened())
{
while(game.PollEvent(event)
{
if(event.Type==sf::Event::Closed)
game.Close();
}
game.Clear();
game.Draw(sprite);
game.Display();
}
return 0;
}
sf::Sprite::SetSubRect(sf::IntRect(Left, Top, Width, Height))
Remember this, this is the key
you can later make functions to automatically do the subrect adjustments for you and viola you have yourself animation
also I just wrote the code above from scratch if it even compiles let me know and if it helps, glad I could be useful to someone xD
edit: forgot to set the sprites texture