pub struct Sprite {Show 20 fields
pub name: String,
pub rect_x: f32,
pub rect_y: f32,
pub rect_width: f32,
pub rect_height: f32,
pub offset_x: f32,
pub offset_y: f32,
pub border_x: f32,
pub border_y: f32,
pub border_z: f32,
pub border_w: f32,
pub pixels_to_units: f32,
pub pivot_x: f32,
pub pivot_y: f32,
pub extrude: u8,
pub is_polygon: bool,
pub render_data: SpriteRenderData,
pub settings: SpriteSettings,
pub atlas_tags: Vec<String>,
pub sprite_atlas_path_id: Option<i64>,
}Expand description
Sprite object representation
Main sprite structure containing all sprite data and metadata.
Fields§
§name: String§rect_x: f32§rect_y: f32§rect_width: f32§rect_height: f32§offset_x: f32§offset_y: f32§border_x: f32§border_y: f32§border_z: f32§border_w: f32§pixels_to_units: f32§pivot_x: f32§pivot_y: f32§extrude: u8§is_polygon: bool§render_data: SpriteRenderData§settings: SpriteSettings§sprite_atlas_path_id: Option<i64>Implementations§
Source§impl Sprite
Helper functions for sprite types
impl Sprite
Helper functions for sprite types
Sourcepub fn get_rect(&self) -> SpriteRect
pub fn get_rect(&self) -> SpriteRect
Get sprite rectangle as SpriteRect
Sourcepub fn get_offset(&self) -> SpriteOffset
pub fn get_offset(&self) -> SpriteOffset
Get sprite offset as SpriteOffset
Sourcepub fn get_pivot(&self) -> SpritePivot
pub fn get_pivot(&self) -> SpritePivot
Get sprite pivot as SpritePivot
Sourcepub fn get_border(&self) -> SpriteBorder
pub fn get_border(&self) -> SpriteBorder
Get sprite border as SpriteBorder
Sourcepub fn has_border(&self) -> bool
pub fn has_border(&self) -> bool
Check if sprite has border (is 9-slice)
Sourcepub fn is_atlas_sprite(&self) -> bool
pub fn is_atlas_sprite(&self) -> bool
Check if sprite is from an atlas
Sourcepub fn get_aspect_ratio(&self) -> f32
pub fn get_aspect_ratio(&self) -> f32
Get sprite aspect ratio
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Sprite
impl<'de> Deserialize<'de> for Sprite
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Sprite
impl RefUnwindSafe for Sprite
impl Send for Sprite
impl Sync for Sprite
impl Unpin for Sprite
impl UnwindSafe for Sprite
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().