Skip to main content

Sprite

Struct Sprite 

Source
pub struct Sprite {
Show 18 fields pub name: &'static str, pub allow_forced_downscale: Option<bool>, pub apply_runtime_tint: Option<bool>, pub apply_special_effect: Option<bool>, pub blend_mode: Option<&'static str>, pub draw_as_glow: Option<bool>, pub draw_as_light: Option<bool>, pub draw_as_shadow: Option<bool>, pub filename: Option<&'static str>, pub generate_sdf: Option<bool>, pub invert_colors: Option<bool>, pub load_in_minimal_mode: Option<bool>, pub mipmap_count: Option<i64>, pub premul_alpha: Option<bool>, pub rotate_shift: Option<bool>, pub scale: Option<f64>, pub tint: Option<Color>, pub tint_as_overlay: Option<bool>,
}
Expand description

Minimal SpritePrototype for data.extend.

Specifies an image that can be used with SpritePath at runtime.

type = "sprite" is injected by the Lua generator.

Fields§

§name: &'static str

Name of the sprite. Can be used as a SpritePath at runtime.

§allow_forced_downscale: Option<bool>

Only loaded if layers is not defined.

If true, the sprite may be downsampled to half its size on load even when ‘Sprite quality’ graphics setting is set to ‘High’. Whether downsampling happens depends on detected hardware and other graphics settings.

§apply_runtime_tint: Option<bool>

Only loaded if layers is not defined.

§apply_special_effect: Option<bool>

Only loaded if layers is not defined.

§blend_mode: Option<&'static str>

Only loaded if layers is not defined.

§draw_as_glow: Option<bool>

Only loaded if layers is not defined.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. This takes precedence over draw_as_light.

Draws first as a normal sprite, then again as a light layer. See https://forums.factorio.com/91682.

§draw_as_light: Option<bool>

Only loaded if layers is not defined.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true.

§draw_as_shadow: Option<bool>

Only loaded if layers is not defined.

Only one of draw_as_shadow, draw_as_glow and draw_as_light can be true. This takes precedence over draw_as_glow and draw_as_light.

§filename: Option<&'static str>

Only loaded, and mandatory if layers is not defined.

The path to the sprite file to use.

§generate_sdf: Option<bool>

Only loaded if layers is not defined.

Unused.

§invert_colors: Option<bool>

Only loaded if layers is not defined.

§load_in_minimal_mode: Option<bool>

Only loaded if layers is not defined.

Minimal mode is entered when mod loading fails. You are in it when you see the gray box after (part of) the loading screen that tells you a mod error. Modders can ignore this property.

§mipmap_count: Option<i64>

Only loaded if layers is not defined.

Only loaded if this is an icon, that is it has the flag "group=icon" or "group=gui".

§premul_alpha: Option<bool>

Only loaded if layers is not defined.

Whether alpha should be pre-multiplied.

§rotate_shift: Option<bool>

Only loaded if layers is not defined.

§scale: Option<f64>

Only loaded if layers is not defined.

Values other than 1 specify the scale of the sprite on default zoom. A scale of 2 means that the picture will be two times bigger on screen (and thus more pixelated).

§tint: Option<Color>

Only loaded if layers is not defined.

§tint_as_overlay: Option<bool>

Only loaded if layers is not defined.

Trait Implementations§

Source§

impl Clone for Sprite

Source§

fn clone(&self) -> Sprite

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 Copy for Sprite

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
Source§

impl PartialEq for Sprite

Source§

fn eq(&self, other: &Sprite) -> 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 Sprite

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