Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - tibor698

Pages: [1]
1
Feature requests / Position Forward Up from Transform
« on: October 06, 2018, 10:51:34 pm »
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.

Pages: [1]
anything