xyginext  0.2.0
Second generation of xygine game creation framework
Public Member Functions | List of all members
xy::Transform Class Referencefinal

Wraps the SFML transformable class in a component friendly format, parentable to other transforms in a scene graph hierachy. Transforms are non-copyable, but are moveable. More...

#include <Transform.hpp>

Inheritance diagram for xy::Transform:

Public Member Functions

 Transform (const Transform &)=delete
 
 Transform (Transform &&) noexcept
 
Transformoperator= (const Transform &)=delete
 
Transformoperator= (Transform &&) noexcept
 
void addChild (Transform &)
 Adds a child transform to this one.
 
void removeChild (Transform &)
 Removes the given child transform from this one, if it exists, else does nothing.
 
sf::Transform getWorldTransform () const
 Returns the world position of this transform by multiplying it with any parent transforms it may have.
 
sf::Vector2f getWorldPosition () const
 Returns the world position of the transform. This is effectively a shortcut for getWorldTransform().transformPoint({}). If this transform does not have a parent transform then getPosition() is probably preferable.
 
float getWorldRotation () const
 Returns the sum of this and all the transform's parents rotations if they exist, else returns the transform's current rotation.
 
std::size_t getDepth () const
 Returns the depth of this transform in the scene hierachy. A value of 0 means it has no parent, 1 means one parent and so on.
 

Detailed Description

Wraps the SFML transformable class in a component friendly format, parentable to other transforms in a scene graph hierachy. Transforms are non-copyable, but are moveable.