Safe Haskell | None |
---|---|
Language | Haskell98 |
Documentation
class SFTransformable a where Source
setPosition :: a -> Vec2f -> IO () Source
Set the position of a transformable.
This function completely overwrites the previous position.
See move
to apply an offset based on the previous position instead.
The default position of a transformable object is (0, 0).
Set the orientation of a transformable.
This function completely overwrites the previous rotation.
See rotate
to add an angle based on the previous rotation instead.
The default rotation of a transformable SFTransformable object is 0.
setScale :: a -> Vec2f -> IO () Source
Set the scale factors of a transformable.
This function completely overwrites the previous scale.
See scale
to add a factor based on the previous scale instead.
The default scale of a transformable SFTransformable object is (1, 1).
setOrigin :: a -> Vec2f -> IO () Source
Set the local origin of a transformable.
The origin of an object defines the center point for all transformations (position, scale, rotation).
The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation).
The default origin of a transformable SFTransformable object is (0, 0).
getPosition :: a -> IO Vec2f Source
Get the position of a transformable.
Get the orientation of a transformable.
getScale :: a -> IO Vec2f Source
Get the current scale of a transformable
getOrigin :: a -> IO Vec2f Source
Get the local origin of a transformable.
move :: a -> Vec2f -> IO () Source
Move a transformable by a given offset
This function adds to the current position of the object,
unlike setPosition
which overwrites it.
Rotate a transformable.
This function adds to the current rotation of the object,
unlike setRotation
which overwrites it.
scale :: a -> Vec2f -> IO () Source
Scale a transformable.
This function multiplies the current scale of the object,
unlike setScale
which overwrites it.
getTransform :: a -> IO Transform Source
Get the combined transform of a transformable.
getInverseTransform :: a -> IO Transform Source
Get the inverse of the combined transform of a transformable.