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.


Messages - tibor698

Pages: [1]
1
Feature requests / Re: Position Forward Up from Transform
« on: October 10, 2018, 07:38:46 pm »
If you look at the translation matrix itself, then yes, the position is perfectly retrievable.

It is if the object is inheriting a sf:Transformable class. The thing is that I only inherited from sf::Drawable and used sf::Transform inside this class. So with this there is no getPosition() from sf:Transform but instead I had to create the code above.

2
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]