pub struct Sprite {
pub transform: Transform,
/* private fields */
}
Fields§
§transform: Transform
Implementations§
source§impl Sprite
impl Sprite
pub fn smooth_circle( window: &Window, pos: Vec2, direction: f32, scale: f32, radius: f32, color: Color ) -> Self
pub fn new_rectangle( window: &Window, pos: Vec2, direction: f32, scale: f32, width: f32, height: f32, color: Color, shape_style: ShapeStyle ) -> Self
pub fn new_image( window: &Window, pos: Vec2, direction: f32, scale: f32, tint: Option<Color>, filename: &str ) -> Self
pub fn new_circle( window: &Window, pos: Vec2, direction: f32, scale: f32, radius: f32, color: Color, shape_style: ShapeStyle ) -> Self
pub fn with_drawable<T: 'static + Drawable>(drawable: T) -> Self
pub fn with_drawable_at<T: 'static + Drawable>( drawable: T, transform: Transform ) -> Self
sourcepub fn draw(&mut self, window: &mut Window)
pub fn draw(&mut self, window: &mut Window)
You must call a Window
’s .drawstart()
before calling this method. draw()
will draw your
image to the current off-screen framebuffer. After the first time a given image value is
drawn it stays on the GPU and during subsequent calls it only sends updated
position/rotation, which is super efficient, so don’t destroy and recreate images every
frame! Draw calls draw to the framebuffer in the order that they occur, so the last image
is on top.
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§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SetParameter for T
impl<T> SetParameter for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.