pub struct PlaydateSprite { /* private fields */ }

Implementations§

source§

impl PlaydateSprite

source

pub fn set_always_redraw(&self, flag: bool)

When flag is set to 1, the given sprite will always redraw.

source

pub fn add_dirty_rect(&self, dirty_rect: SideOffsets2D<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.

source

pub fn draw_sprites(&self)

Draws every sprite in the display list.

source

pub fn update_and_draw_sprites(&self)

Updates and draws every sprite in the display list.

source

pub fn new_sprite(&self) -> Sprite

Allocates and returns a new LCDSprite.

source

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.

source

pub fn remove_sprite(&self, sprite: impl AsRef<Sprite>)

Removes the given sprite from the display list.

source

pub fn remove_sprites(&self, sprites: &[&Sprite])

Removes the given count sized array of sprites from the display list.

source

pub fn remove_all_sprites(&self)

Removes all sprites from the display list.

source

pub fn get_sprite_count(&self) -> usize

Returns the total number of sprites in the display list.

source

pub fn set_clip_rects_in_range( &self, clip_rect: SideOffsets2D<i32>, start_z: i32, end_z: i32 )

Sets the clipping rectangle for all sprites with a Z index within startZ and endZ inclusive.

source

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.

source

pub fn reset_collision_world(&self)

Frees and reallocates internal collision data, resetting everything to its default state.

source

pub fn check_collisions( &self, sprite: impl AsRef<Sprite>, goal_x: f32, goal_y: f32 ) -> Vec<SpriteCollisionInfo<'_>>

Returns the same values as playdate->sprite->moveWithCollisions() but does not actually move the sprite.

source

pub fn move_with_collisions( &self, sprite: impl AsRef<Sprite>, goal_x: f32, goal_y: f32 ) -> Vec<SpriteCollisionInfo<'_>>

Moves the given sprite towards goalX, goalY taking collisions into account and returns an array of SpriteCollisionInfo. len is set to the size of the array and actualX, actualY are set to the sprite’s position after collisions. If no collisions occurred, this will be the same as goalX, goalY.

source

pub fn query_sprites_at_point(&self, x: f32, y: f32) -> Vec<Ref<'_, Sprite>>

source

pub fn query_sprites_in_rect( &self, x: f32, y: f32, width: f32, height: f32 ) -> Vec<Ref<'_, Sprite>>

source

pub fn query_sprites_along_line( &self, x1: f32, y1: f32, x2: f32, y2: f32 ) -> Vec<Ref<'_, Sprite>>

source

pub fn query_sprite_info_along_line( &self, x1: f32, y1: f32, x2: f32, y2: f32 ) -> Vec<SpriteQueryInfo<'_>>

source

pub fn overlapping_sprites( &self, sprite: impl AsRef<Sprite> ) -> Vec<Ref<'_, Sprite>>

Returns an array of sprites that have collide rects that are currently overlapping the given sprite’s collide rect.

source

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).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.