pub struct PlaydateSprite { /* private fields */ }Implementations§
Source§impl PlaydateSprite
impl PlaydateSprite
Sourcepub fn set_always_redraw(&self, flag: bool)
pub fn set_always_redraw(&self, flag: bool)
When flag is set to 1, the given sprite will always redraw.
Sourcepub fn add_dirty_rect(&self, dirty_rect: SideOffsets<i32>)
pub fn add_dirty_rect(&self, dirty_rect: SideOffsets<i32>)
Marks the given dirtyRect (in screen coordinates) as needing a redraw. Graphics drawing functions now call this automatically, adding their drawn areas to the sprite’s dirty list, so there’s usually no need to call this manually.
Sourcepub fn draw_sprites(&self)
pub fn draw_sprites(&self)
Draws every sprite in the display list.
Sourcepub fn update_and_draw_sprites(&self)
pub fn update_and_draw_sprites(&self)
Updates and draws every sprite in the display list.
Sourcepub fn add_sprite(&self, sprite: impl AsRef<Sprite>)
pub fn add_sprite(&self, sprite: impl AsRef<Sprite>)
Adds the given sprite to the display list, so that it is drawn in the current scene.
Sourcepub fn remove_sprite(&self, sprite: impl AsRef<Sprite>)
pub fn remove_sprite(&self, sprite: impl AsRef<Sprite>)
Removes the given sprite from the display list.
Sourcepub fn remove_sprites(&self, sprites: &[&Sprite])
pub fn remove_sprites(&self, sprites: &[&Sprite])
Removes the given count sized array of sprites from the display list.
Sourcepub fn remove_all_sprites(&self)
pub fn remove_all_sprites(&self)
Removes all sprites from the display list.
Sourcepub fn get_sprite_count(&self) -> usize
pub fn get_sprite_count(&self) -> usize
Returns the total number of sprites in the display list.
Sourcepub fn set_clip_rects_in_range(
&self,
clip_rect: SideOffsets<i32>,
start_z: i32,
end_z: i32,
)
pub fn set_clip_rects_in_range( &self, clip_rect: SideOffsets<i32>, start_z: i32, end_z: i32, )
Sets the clipping rectangle for all sprites with a Z index within startZ and endZ inclusive.
Sourcepub fn clear_clip_rects_in_range(&self, start_z: i32, end_z: i32)
pub fn clear_clip_rects_in_range(&self, start_z: i32, end_z: i32)
Clears the clipping rectangle for all sprites with a Z index within startZ and endZ inclusive.
Sourcepub fn reset_collision_world(&self)
pub fn reset_collision_world(&self)
Frees and reallocates internal collision data, resetting everything to its default state.
pub fn query_sprites_at_point(&self, pos: Vec2<f32>) -> Vec<Ref<'_, Sprite>>
pub fn query_sprites_in_rect(&self, rect: Rect<f32>) -> Vec<Ref<'_, Sprite>>
pub fn query_sprites_along_line( &self, x1: f32, y1: f32, x2: f32, y2: f32, ) -> Vec<Ref<'_, Sprite>>
pub fn query_sprite_info_along_line( &self, x1: f32, y1: f32, x2: f32, y2: f32, ) -> Vec<SpriteQueryInfo<'_>>
Sourcepub fn all_overlapping_sprites(&self) -> Vec<Ref<'_, Sprite>>
pub fn all_overlapping_sprites(&self) -> Vec<Ref<'_, Sprite>>
Returns an array of all sprites that have collide rects that are currently overlapping. Each consecutive pair of sprites is overlapping (eg. 0 & 1 overlap, 2 & 3 overlap, etc).