How do I center a Sprite while rotating and scaling Sprite ?
void Visuals::DisplaySpriteOntoScreenBuffer(uint16_t spriteIndex, float spriteX, float spriteY, bool centerX, sf::Color color, float scaleX, float scaleY, float rotation)
{
Sprites[spriteIndex].SetScale(scaleX, scaleX);
Sprites[spriteIndex].SetRotation(rotation);
Sprites[spriteIndex].SetCenter( (Sprites[spriteIndex].GetSize().x / 2), (Sprites[spriteIndex].GetSize().y / 2) );
if (centerX == true)
{
Sprites[spriteIndex].SetX(320); // Screen size is 640x640...
}
else Sprites[spriteIndex].SetX(spriteX);
Sprites[spriteIndex].SetY(spriteY);
Sprites[spriteIndex].SetColor(color);
App.Draw(Sprites[spriteIndex]);
}
Above code compiles and links with zero warnings and zero errors...
Any ideas on how to make this work?
(code is from a C++ Class called "Visuals")