pub struct SpriteAsset {
pub transparent: bool,
pub mip_chain: ArrayVec<SpriteMipLevel, MAX_MIPS>,
}
Expand description
Drawable image.
Fields§
§transparent: bool
Whether the sprite’s alpha should be taken into consideration while rendering.
mip_chain: ArrayVec<SpriteMipLevel, MAX_MIPS>
The actual specific-size sprites used for rendering depending on the size of the sprite on screen.
Implementations§
Source§impl SpriteAsset
impl SpriteAsset
Sourcepub fn draw(
&self,
dst: Rect,
draw_order: u8,
draw_queue: &mut DrawQueue<'_>,
resources: &ResourceDatabase,
resource_loader: &mut ResourceLoader,
) -> bool
pub fn draw( &self, dst: Rect, draw_order: u8, draw_queue: &mut DrawQueue<'_>, resources: &ResourceDatabase, resource_loader: &mut ResourceLoader, ) -> bool
Draw this sprite into the dst
rectangle.
Returns false if the sprite couldn’t be drawn due to the draw queue filling up. Note that one draw may cause multiple draws in the queue, since sprites are split into chunks, each of which gets drawn as a separate quad.
Trait Implementations§
Source§impl Asset for SpriteAsset
impl Asset for SpriteAsset
Source§fn get_chunks(&self) -> Option<Range<u32>>
fn get_chunks(&self) -> Option<Range<u32>>
If this asset refers to any regular chunks, returns the range
referenced.
Source§fn offset_chunks(&mut self, _offset: i32)
fn offset_chunks(&mut self, _offset: i32)
Applies an offset to all regular chunk references in the asset.
Source§fn get_sprite_chunks(&self) -> Option<Range<u32>>
fn get_sprite_chunks(&self) -> Option<Range<u32>>
If this asset refers to any sprite chunks, returns the range referenced.
Source§fn offset_sprite_chunks(&mut self, offset: i32)
fn offset_sprite_chunks(&mut self, offset: i32)
Applies an offset to all sprite chunk references in the asset.
Source§impl Debug for SpriteAsset
impl Debug for SpriteAsset
Source§impl Deserialize for SpriteAsset
impl Deserialize for SpriteAsset
Source§const SERIALIZED_SIZE: usize = 158usize
const SERIALIZED_SIZE: usize = 158usize
The length of the buffer passed into
Deserialize::deserialize
.Source§fn deserialize(src: &[u8]) -> Self
fn deserialize(src: &[u8]) -> Self
Deserializes the byte buffer into the struct. The length of
src
must
match the same type’s Deserialize::SERIALIZED_SIZE
constant.Source§impl Serialize for SpriteAsset
impl Serialize for SpriteAsset
Source§const SERIALIZED_SIZE: usize = 158usize
const SERIALIZED_SIZE: usize = 158usize
The length of the buffer passed into
Serialize::serialize
.Source§fn serialize(&self, dst: &mut [u8])
fn serialize(&self, dst: &mut [u8])
Serializes the struct into the byte buffer. The length of
dst
must
match the same type’s Serialize::SERIALIZED_SIZE
constant.Auto Trait Implementations§
impl Freeze for SpriteAsset
impl RefUnwindSafe for SpriteAsset
impl Send for SpriteAsset
impl Sync for SpriteAsset
impl Unpin for SpriteAsset
impl UnwindSafe for SpriteAsset
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