[][src]Enum ggez::graphics::Transform

pub enum Transform {
    Values {
        dest: Point2<f32>,
        rotation: f32,
        scale: Vector2<f32>,
        offset: Point2<f32>,
    },
    Matrix(ColumnMatrix4<f32>),
}

A struct that represents where to put a Drawable.

This can either be a set of individual components, or a single Matrix4 transform.

Variants

Values

Transform made of individual values

Fields of Values

dest: Point2<f32>

The position to draw the graphic expressed as a Point2.

rotation: f32

The orientation of the graphic in radians.

scale: Vector2<f32>

The x/y scale factors expressed as a Vector2.

offset: Point2<f32>

An offset from the center for transform operations like scale/rotation, with 0,0 meaning the origin and 1,1 meaning the opposite corner from the origin. By default these operations are done from the top-left corner, so to rotate something from the center specify Point2::new(0.5, 0.5) here.

Transform made of an arbitrary matrix.

It should represent the final model matrix of the given drawable. This is useful for situations where, for example, you build your own hierarchy system, where you calculate matrices of each hierarchy item and store a calculated world-space model matrix of an item. This lets you implement transform stacks, skeletal animations, etc.

Implementations

impl Transform[src]

pub fn to_matrix(&self) -> Self[src]

Crunches the transform down to a single matrix, if it's not one already.

pub fn to_bare_matrix(&self) -> ColumnMatrix4<f32>[src]

Same as to_matrix() but just returns a bare mint matrix.

Trait Implementations

impl Clone for Transform[src]

impl Copy for Transform[src]

impl Debug for Transform[src]

impl Default for Transform[src]

impl PartialEq<Transform> for Transform[src]

impl StructuralPartialEq for Transform[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,