pub struct Texture(/* private fields */);
Expand description
A texture that can be manipulated and displayed on script texture slots.
Implementations§
Source§impl Texture
impl Texture
Sourcepub fn create(options: TextureCreationOptions<'_>) -> Self
pub fn create(options: TextureCreationOptions<'_>) -> Self
Create a new texture.
Sourcepub fn add_action(&mut self, action: TextureAction)
pub fn add_action(&mut self, action: TextureAction)
Add an action to the texture. You may want to call the helper methods instead of this.
Sourcepub fn draw_rect(
&mut self,
start: impl Into<UVec2>,
end: impl Into<UVec2>,
color: Color,
)
pub fn draw_rect( &mut self, start: impl Into<UVec2>, end: impl Into<UVec2>, color: Color, )
Draw a rectangle on the texture.
Sourcepub fn set_pixel<P>(&mut self, draw_pixel: P)
pub fn set_pixel<P>(&mut self, draw_pixel: P)
For better performance, use Self::set_pixels
instead with all the pixels you want to set.
This is only here for convenience.
Sourcepub fn set_pixels<P>(&mut self, pixels: &[P])
pub fn set_pixels<P>(&mut self, pixels: &[P])
Set multiple pixels on the texture.
Sourcepub fn draw_texture(&mut self, other: &Texture, options: DrawTextureOpts)
pub fn draw_texture(&mut self, other: &Texture, options: DrawTextureOpts)
Draws another texture on top of this one.
Sourcepub fn apply_to(&mut self, name: &str)
pub fn apply_to(&mut self, name: &str)
Call this once for every game-texture you want to apply this to. You can define the name in the content tool.
Sourcepub fn flush(&mut self) -> bool
pub fn flush(&mut self) -> bool
Only call this if you need your actions to be applied immediately. Cause of streaming assets, this method will return false if the actions are not yet applied. Just call this method again until it returns true.
Sourcepub fn handle(&self) -> TextureHandle
pub fn handle(&self) -> TextureHandle
Get the handle of the texture.