Skip to main content

Texture

Struct Texture 

Source
pub struct Texture(/* private fields */);
Expand description

Textur, die bearbeitet und auf Script-Textur-Slots angezeigt werden kann.

A texture that can be manipulated and displayed on script texture slots.

Implementations§

Source§

impl Texture

Source

pub fn create<'a>(options: impl Into<TextureCreationOptions<'a>>) -> Self

Erstellt eine neue Script-Textur.

Creates a new script texture.

Source

pub fn add_action(&mut self, action: TextureAction)

Fügt eine Zeichenaktion zur Textur hinzu. Bevorzugt die Hilfsmethoden statt direktem Aufruf.

Adds a drawing action to the texture. Prefer the helper methods over calling this directly.

Source

pub fn draw_rect( &mut self, start: impl Into<UVec2>, end: impl Into<UVec2>, color: Color, )

Zeichnet ein Rechteck auf die Textur.

Draws a rectangle on the texture.

Source

pub fn clear(&mut self, color: Color)

Füllt die Textur mit einer Farbe.

Clears the texture with a color.

Source

pub fn read_pixel(&self, x: u32, y: u32) -> Color

Liest die Farbe eines Pixels auf der Textur.

Reads the color of a pixel on the texture.

Source

pub fn draw_pixels<P>(&mut self, pixels: &[P])
where P: Into<DrawPixel> + Copy,

Zeichnet mehrere Pixel auf die Textur.

Draws multiple pixels on the texture.

Source

pub fn draw_texture(&mut self, other: &Texture, options: DrawTextureOpts)

Zeichnet eine andere Textur über diese.

Draws another texture on top of this one.

Source

pub fn apply_to(&mut self, name: &str)

Wendet die Textur auf einen benannten Spiel-Textur-Slot an (Name im Content-Tool). Einmal pro Ziel-Slot aufrufen.

Applies the texture to a named in-game texture slot (name defined in the content tool). Call once per target slot.

Source

pub fn flush(&mut self) -> bool

Wendet ausstehende Aktionen sofort an. Kann false liefern, solange Assets noch streamen — erneut aufrufen, bis true.

Applies pending actions immediately. May return false while assets are still streaming; call again until true.

Source

pub fn draw_script_texture(&mut self, other: &Texture, options: DrawTextureOpts)

Zeichnet eine andere Script-Textur über diese.

Draws another script texture on top of this one.

Source

pub fn draw_text( &mut self, font: ContentId, text: impl Into<String>, top_left: impl Into<IVec2>, letter_spacing: u32, full_color: impl Into<Option<Color>>, alpha_mode: AlphaMode, target_rect: impl Into<Option<Rectangle>>, )

Zeichnet Text auf die Textur.

Draws text on the texture.

Source

pub fn handle(&self) -> TextureHandle

Gibt den Handle der Textur zurück.

Returns the handle of the texture.

Source

pub fn forget(self)

Verhindert das Freigeben beim Drop — Textur bleibt ohne Referenz bestehen. Nur verwenden, wenn die Textur absichtlich ohne Handle weiterleben soll.

Prevents disposal on drop so the texture outlives this handle. Use only when the texture should stay alive without a reference.

Source

pub fn expose(&self, name: &str)

Stellt die Textur unter dem angegebenen Namen für die Plugin-API bereit.

Exposes the texture to the plugin API under the given name.

Trait Implementations§

Source§

impl Debug for Texture

Source§

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

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

impl Drop for Texture

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl From<&Texture> for DrawableTexture

Source§

fn from(texture: &Texture) -> Self

Converts to this type from the input type.

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