Skip to main content

Object

Struct Object 

Source
pub struct Object { /* private fields */ }
Expand description

An object that can be shown on the screen

Implementations§

Source§

impl Object

Source

pub fn show(&self, frame: &mut GraphicsFrame<'_>)

Show the object on the current frame.

Objects with the .show() function called first will be rendered above those which have .show() called on them afterwards. It is up to you to order the objects in the correct way before calling .show() on them.

Source

pub fn new(sprite: impl Into<SpriteVram>) -> Self

Creates an object from a sprite in vram.

Source

pub fn set_hflip(&mut self, flip: bool) -> &mut Self

Sets the horizontal flip, note that this only has a visible affect in Normal mode.
Use hflip to get the value

Source

pub fn hflip(&self) -> bool

Returns the horizontal flip
Use set_hflip to set the value

Source

pub fn set_vflip(&mut self, flip: bool) -> &mut Self

Sets the vertical flip, note that this only has a visible affect in Normal mode.
Use vflip to get the value

Source

pub fn vflip(&self) -> bool

Returns the vertical flip
Use set_vflip to set the value

Source

pub fn set_priority(&mut self, priority: Priority) -> &mut Self

Sets the priority of the object relative to the backgrounds priority.
Use priority to get the value

Source

pub fn priority(&self) -> Priority

Returns the priority of the object
Use set_priority to set the value

Source

pub fn set_pos(&mut self, position: impl Into<Vector2D<i32>>) -> &mut Self

Sets the position of the object.
Use pos to get the value

Source

pub fn pos(&self) -> Vector2D<i32>

Returns the position of the object
Use set_pos to set the value

Source

pub fn set_sprite(&mut self, sprite: impl Into<SpriteVram>) -> &mut Self

Sets the current sprite for the object.

Source

pub fn set_graphics_mode(&mut self, mode: GraphicsMode) -> &mut Self

Sets the graphics mode of the object

Trait Implementations§

Source§

impl Clone for Object

Source§

fn clone(&self) -> Object

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Object

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Object

§

impl !RefUnwindSafe for Object

§

impl !Send for Object

§

impl !Sync for Object

§

impl Unpin for Object

§

impl !UnwindSafe for Object

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.