Struct sfml::graphics::Transformable
[−]
[src]
pub struct Transformable {
// some fields omitted
}Target for off-screen 2D rendering into a texture
Methods
impl Transformable[src]
fn new() -> Option<Transformable>
Create a new transformable
Return Some(Transformable) or None
fn clone_opt(&self) -> Option<Transformable>
Copy an existing transformable
Return Some(Transformable) or None
fn set_position(&mut self, position: &Vector2f)
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 Transformable object is (0, 0).
Arguments
- position - The new position
fn set_rotation(&mut self, angle: f32)
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 Transformable object is 0.
Arguments
- angle - The new rotation, in degrees
fn set_scale(&mut self, scale: &Vector2f)
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 Transformable object is (1, 1).
Arguments
- scale - New scale factors
fn set_origin(&mut self, origin: &Vector2f)
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 Transformable object is (0, 0).
Arguments
- origin - New origin
fn get_position(&self) -> Vector2f
Get the position of a transformable
Return the current position
fn get_rotation(&self) -> f32
Get the orientation of a transformable
The rotation is always in the range [0, 360].
Return the current rotation, in degrees
fn get_scale(&self) -> Vector2f
Get the current scale of a transformable
Return the current scale factors
fn get_origin(&self) -> Vector2f
Get the local origin of a transformable
Return the current origin
fn move_(&mut self, offset: &Vector2f)
Move a transformable by a given offset
This function adds to the current position of the object, unlike set_position which overwrites it.
Arguments
- offset - Offset
fn rotate(&mut self, angle: f32)
Rotate a transformable
This function adds to the current rotation of the object, unlike set_rotation which overwrites it.
Arguments
- angle - Angle of rotation, in degrees
fn scale(&mut self, factors: &Vector2f)
Scale a transformable
This function multiplies the current scale of the object, unlike set_scale which overwrites it.
Arguments
- factors - Scale factors
fn get_transform(&self) -> Transform
Get the combined transform of a transformable
Return the transform combining the position/rotation/scale/origin of the object
fn get_inverse_transform(&self) -> Transform
Get the inverse of the combined transform of a transformable
Return the inverse of the combined transformations applied to the object
Trait Implementations
impl Clone for Transformable[src]
fn clone(&self) -> Transformable
Return a new Transformable or panic! if there is not enough memory
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more