Skip to content

Instantly share code, notes, and snippets.

@ricanteja
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricanteja/dfaed2a3571724c553a7 to your computer and use it in GitHub Desktop.
Save ricanteja/dfaed2a3571724c553a7 to your computer and use it in GitHub Desktop.
SFML sf::Image rotation
// Small code for rotating an image
#include <SFML\Graphics.hpp>
void rotateImage(sf::Image& image)
{
sf::Vector2u size = image.getSize();
sf::Image rotated_image;
rotated_image.create(size.y, size.x);
for(unsigned int col = 0; col < size.y; col++)
{
for(unsigned int row = 0; row < size.x; row++)
rotated_image.setPixel(col, (size.x - 1) - row, image.getPixel(row, col));
}
image = rotated_image;
}
@ricanteja
Copy link
Author

Removed all my specific code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment