Skip to main content

SpriteDrawable

Struct SpriteDrawable 

Source
pub struct SpriteDrawable {
    pub position: Point<i32>,
    pub sprite_id: SpriteId,
    pub last_state_change: Instant,
    pub animation_type: AnimationInfo,
}

Fields§

§position: Point<i32>§sprite_id: SpriteId§last_state_change: Instant§animation_type: AnimationInfo

Trait Implementations§

Source§

impl Clone for SpriteDrawable

Source§

fn clone(&self) -> SpriteDrawable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpriteDrawable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drawable for SpriteDrawable

Source§

fn size(&self, sprites: &SpriteRegistry) -> Result<(u16, u16), DrawError>

Source§

fn as_single_pointed_mut(&mut self) -> Option<&mut dyn SinglePointed>

Source§

fn draw( &mut self, sprites: &SpriteRegistry, ) -> Result<BasicDrawCreator, DrawError>

The Output of this function will be used to render to the terminal
Source§

fn bounding_iv(&self, sprites: &SpriteRegistry) -> Option<UpdateIntervalCreator>

Return an UpdateIntervalCreator Read more
Source§

fn on_screen_select( &mut self, selected_screen: TargetScreen, ) -> Result<(), DrawError>

Source§

fn on_any_key_press( &mut self, msg: KeyMessage, screen: TargetScreen, ) -> Result<(), DrawError>

gets triggered, if any key with any selected screen has been pressed. To know, if the drawable is on this screen: 1. use the on_key_press function 2. pass the screen_id of the screen that the drawable is on to the drawable and check manually
Source§

fn on_key_press(&mut self, msg: KeyMessage) -> Result<(), DrawError>

gets triggered, if a key has been pressed and the screen, which the drawable is on is selected. If you want react to global keypresses use the trait function ‘on_any_keypress’
Source§

fn on_mousekey_press(&mut self, msg: MouseMessage) -> Result<(), DrawError>

gets triggered, if a mouse_key has been pressed and the screen, which the drawable is on is selected. If you want react to global keypresses use the trait function ‘on_any_keypress’
Source§

fn on_any_mousekey_press( &mut self, msg: MouseMessage, screen: TargetScreen, ) -> Result<(), DrawError>

gets triggered, if any mouse_key with any selected screen has been pressed. To know, if the drawable is on this screen: 1. use the on_mousekey_press function 2. pass the screen_id of the screen that the drawable is on to the drawable and check manually
Source§

fn get_top_left(&mut self) -> Option<Point<i32>>

Source§

fn as_double_pointed_mut(&mut self) -> Option<&mut dyn DoublePointed>

Source§

fn as_multi_pointed_mut(&mut self) -> Option<&mut dyn MultiPointed>

Source§

fn as_screen_fitting_mut(&mut self) -> Option<&mut dyn ScreenFitting>

Source§

impl Eq for SpriteDrawable

Source§

impl PartialEq for SpriteDrawable

Source§

fn eq(&self, other: &SpriteDrawable) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl SinglePointed for SpriteDrawable

Source§

fn position(&self) -> Point<i32>

The current position of the object.
Source§

fn set_position(&mut self, p: Point<i32>)

Change the stored position.
Source§

impl StructuralPartialEq for SpriteDrawable

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.