I recently started using SFML and its transforms and I had to extend sf::Transform as it lacked some functionality that I needed.
This is an example of my code:
// some class
sf::Transform _transform;
sf::Vector2f Position2() const { return sf::Vector2f(_transform.getMatrix()[2], _transform.getMatrix()[6]); }
sf::Vector2f Scale2() const { return sf::Vector2f(_transform.getMatrix()[0], _transform.getMatrix()[5]); }
void Position2(sf::Vector2f value)
{
sf::Transform tmp(_transform.getMatrix()[0], _transform.getMatrix()[1], value.x,
_transform.getMatrix()[4], _transform.getMatrix()[5], value.y,
_transform.getMatrix()[8], _transform.getMatrix()[9], _transform.getMatrix()[10]);
_transform = tmp;
}
sf::Vector2f Right2() const { return sf::Vector2f(_transform.getMatrix()[0], _transform.getMatrix()[1]); }
sf::Vector2f Up2() const { return sf::Vector2f(_transform.getMatrix()[4], _transform.getMatrix()[5]); }
Could something like this be implemented into sf::Transform? For e.g. there is a method sf::Transform::translate() which translates based of current values but there is no functionality to set position directly.