Struct Sprite

Source
pub struct Sprite {
Show 19 fields pub id: SpriteID, pub name: String, pub filename: String, pub slp_id: Option<GraphicID>, pub is_loaded: bool, pub layer: u8, pub color_table: u16, pub transparent_selection: bool, pub bounding_box: (i16, i16, i16, i16), pub sound_id: Option<SoundID>, pub num_frames: u16, pub num_angles: u16, pub base_speed: f32, pub frame_rate: f32, pub replay_delay: f32, pub sequence_type: u8, pub mirror_flag: i8, pub deltas: Vec<SpriteDelta>, pub attack_sounds: Vec<SpriteAttackSound>, /* private fields */
}

Fields§

§id: SpriteID§name: String§filename: String§slp_id: Option<GraphicID>

The SLP resource ID for this sprite.

§is_loaded: bool§layer: u8

The layer describes order of graphics being rendered. Possible values: 0 (lowest layer) to 40 (highest layer) Graphics on a higher layer will be rendered above graphics of a lower layer. If graphics share the same layer, graphics will be displayed dependend on their map positions.

Draw Level

0   Terrain
5   Shadows, farms
6   Rubble
10   Constructions, corpses, shadows, flowers, ruins
11   Fish
19   Rugs, craters
20   Buildings, units, damage flames, mill animation
21   Blacksmith smoke
22   Hawk
30   Projectiles, explosions
§color_table: u16§transparent_selection: bool§bounding_box: (i16, i16, i16, i16)§sound_id: Option<SoundID>§num_frames: u16

Number of frames per angle animation

§num_angles: u16

Number of angles tored in slp and also the number of extra structures. If there are more than 1 angle, AngleCount/2 - 1 frames will be mirrored. That means angles starting from south going clockwise to north are stored and the others will be mirrored.

§base_speed: f32

If this is over 0, the speed of the unit will be replaced with this.

§frame_rate: f32

Frame rate in seconds. (Delay between frames)

§replay_delay: f32

Time to wait until the animation sequence is started again.

§sequence_type: u8§mirror_flag: i8§deltas: Vec<SpriteDelta>§attack_sounds: Vec<SpriteAttackSound>

Implementations§

Source§

impl Sprite

Source

pub fn read_from(input: impl Read) -> Result<Self>

Source

pub fn write_to<W: Write>(&self, output: &mut W) -> Result<()>

Trait Implementations§

Source§

impl Clone for Sprite

Source§

fn clone(&self) -> Sprite

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Sprite

Source§

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

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

impl Default for Sprite

Source§

fn default() -> Sprite

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Sprite

§

impl RefUnwindSafe for Sprite

§

impl Send for Sprite

§

impl Sync for Sprite

§

impl Unpin for Sprite

§

impl UnwindSafe for Sprite

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