Skip to main content

SpriteSpec

Struct SpriteSpec 

Source
pub struct SpriteSpec {
    pub name: Vec<u8>,
    pub rect: [f32; 4],
    pub settings: u32,
    pub ppu: f32,
    pub texture: (i32, i64),
    pub alpha: (i32, i64),
    pub mesh: Mesh,
    pub atlas: (i32, i64),
    pub key: ([u32; 4], i64),
    pub tags: Vec<Vec<u8>>,
}
Expand description

A Sprite: its name, textureRect and settingsRaw, m_PixelsToUnits, its texture’s and alpha texture’s pointers and its mesh.

Fields§

§name: Vec<u8>

m_Name.

§rect: [f32; 4]

m_RD.textureRect: x, y, width, height.

§settings: u32

m_RD.settingsRaw.

§ppu: f32

m_PixelsToUnits.

§texture: (i32, i64)

m_RD.texture.

§alpha: (i32, i64)

m_RD.alphaTexture (null: none).

§mesh: Mesh

m_RD’s mesh.

§atlas: (i32, i64)

m_SpriteAtlas (null: none).

§key: ([u32; 4], i64)

m_RenderDataKey: its GUID’s words and its id.

§tags: Vec<Vec<u8>>

m_AtlasTags.

Implementations§

Source§

impl SpriteSpec

Source

pub fn rect(name: &str, rect: [f32; 4], texture: (i32, i64)) -> Self

A rectangle Sprite name of rect on the texture at texture, with no alpha texture and no mesh, m_PixelsToUnits 1.

Source

pub fn tight( name: &str, rect: [f32; 4], texture: (i32, i64), mesh: Mesh, ) -> Self

A tight Sprite name of rect on texture, masked by mesh’s triangles at m_PixelsToUnits 16.

Source

pub fn settings(self, settings: u32) -> Self

The same Sprite with settingsRaw settings.

Source

pub fn alpha(self, alpha: (i32, i64)) -> Self

The same Sprite with its alpha texture at alpha.

Source

pub fn in_atlas(self, atlas: (i32, i64)) -> Self

The same Sprite with m_SpriteAtlas at atlas.

Source

pub fn tagged(self, tags: &[&str]) -> Self

The same Sprite with m_AtlasTags tags.

Source

pub fn keyed(self, key: ([u32; 4], i64)) -> Self

The same Sprite with m_RenderDataKey key.

Source

pub fn value(&self) -> V

The Sprite’s value.

Source

pub fn object(&self, path_id: i64) -> Object

The Sprite as an object at path_id.

Trait Implementations§

Source§

impl Clone for SpriteSpec

Source§

fn clone(&self) -> Self

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 SpriteSpec

Source§

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

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

impl PartialEq for SpriteSpec

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SpriteSpec

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