pub struct Sprite {
pub origin: Point3D<f32, WorldSpace>,
pub size: Size2D<f32, ObjectSpace>,
pub rotation: Rotation3D<f32, ObjectSpace, ObjectSpace>,
pub texture: Rc<Texture>,
}
Expand description
Basic textured rectangle.
Basic textured rectangle. Uses the same position and size system as super::primative::Rectangle
with an origin at its centre and a width and height
Uses the QuadPipe
pipeline
Fields
origin: Point3D<f32, WorldSpace>
The centre of the sprite
size: Size2D<f32, ObjectSpace>
The size of the sprite
rotation: Rotation3D<f32, ObjectSpace, ObjectSpace>
The rotation of the sprite
texture: Rc<Texture>
The texture of the sprite
Implementations
sourceimpl Sprite
impl Sprite
sourcepub fn new(
origin: impl Into<Point3D<f32, WorldSpace>>,
size: impl Into<Size2D<f32, ObjectSpace>>,
texture: Rc<Texture>
) -> Self
pub fn new(
origin: impl Into<Point3D<f32, WorldSpace>>,
size: impl Into<Size2D<f32, ObjectSpace>>,
texture: Rc<Texture>
) -> Self
Create a new sprite
pub fn rotate(&mut self, rotation: Rotation3D<f32, ObjectSpace, ObjectSpace>)
sourcepub fn translate(
&mut self,
translation: Translation3D<f32, WorldSpace, WorldSpace>
)
pub fn translate(
&mut self,
translation: Translation3D<f32, WorldSpace, WorldSpace>
)
Translate the sprite
sourcepub fn scale(&mut self, size: Size2D<f32, ObjectSpace>)
pub fn scale(&mut self, size: Size2D<f32, ObjectSpace>)
Set the sprites size
sourcepub fn update_texture(&mut self, texture: Rc<Texture>)
pub fn update_texture(&mut self, texture: Rc<Texture>)
Update the texture of the sprite
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Sprite
impl !Send for Sprite
impl !Sync for Sprite
impl Unpin for Sprite
impl !UnwindSafe for Sprite
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more