Struct bevy_sprite::TextureSlice
source · pub struct TextureSlice {
pub texture_rect: Rect,
pub draw_size: Vec2,
pub offset: Vec2,
}
Expand description
Single texture slice, representing a texture rect to draw in a given area
Fields§
§texture_rect: Rect
texture area to draw
draw_size: Vec2
slice draw size
offset: Vec2
offset of the slice
Implementations§
source§impl TextureSlice
impl TextureSlice
sourcepub fn tiled(
self,
stretch_value: f32,
(tile_x, tile_y): (bool, bool)
) -> Vec<Self>
pub fn tiled( self, stretch_value: f32, (tile_x, tile_y): (bool, bool) ) -> Vec<Self>
Transforms the given slice in an collection of tiled subdivisions.
§Arguments
stretch_value
- The slice will repeat when the ratio between the drawing dimensions of texture and the original texture size (rect) are abovestretch_value
.
tile_x
- should the slice be tiled horizontallytile_y
- should the slice be tiled vertically
Trait Implementations§
source§impl Clone for TextureSlice
impl Clone for TextureSlice
source§fn clone(&self) -> TextureSlice
fn clone(&self) -> TextureSlice
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TextureSlice
impl Debug for TextureSlice
source§impl PartialEq for TextureSlice
impl PartialEq for TextureSlice
source§fn eq(&self, other: &TextureSlice) -> bool
fn eq(&self, other: &TextureSlice) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for TextureSlice
Auto Trait Implementations§
impl Freeze for TextureSlice
impl RefUnwindSafe for TextureSlice
impl Send for TextureSlice
impl Sync for TextureSlice
impl Unpin for TextureSlice
impl UnwindSafe for TextureSlice
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.