[−][src]Struct bevy::prelude::TextureAtlas
An atlas containing multiple textures (like a spritesheet or a tilemap)
Fields
texture: Handle<Texture>
The handle to the texture in which the sprites are stored
size: Vec2
textures: Vec<Rect>
The specific areas of the atlas where each texture can be found
texture_handles: Option<HashMap<Handle<Texture>, usize, RandomState>>
Implementations
impl TextureAtlas
[src]
pub fn new_empty(texture: Handle<Texture>, dimensions: Vec2) -> TextureAtlas
[src]
Create a new TextureAtlas
that has a texture, but does not have
any individual sprites specified
pub fn from_grid(
texture: Handle<Texture>,
size: Vec2,
columns: usize,
rows: usize
) -> TextureAtlas
[src]
texture: Handle<Texture>,
size: Vec2,
columns: usize,
rows: usize
) -> TextureAtlas
Generate a TextureAtlas
by splitting a texture into a grid where each
cell of the grid is one of the textures in the atlas
pub fn add_texture(&mut self, rect: Rect)
[src]
Add a sprite to the list of textures in the TextureAtlas
Arguments
rect
- The section of the atlas that contains the texture to be added, from the top-left corner of the texture to the bottom-right corner
pub fn len(&self) -> usize
[src]
How many textures are in the TextureAtlas
pub fn is_empty(&self) -> bool
[src]
pub fn get_texture_index(&self, texture: Handle<Texture>) -> Option<usize>
[src]
Trait Implementations
impl RenderResources for TextureAtlas
[src]
fn render_resources_len(&self) -> usize
[src]
fn get_render_resource(&self, index: usize) -> Option<&dyn RenderResource>
[src]
fn get_render_resource_name(&self, index: usize) -> Option<&str>
[src]
fn get_render_resource_hints(&self, index: usize) -> Option<RenderResourceHints>
[src]
fn iter(&self) -> RenderResourceIterator<'_>
[src]
Auto Trait Implementations
impl RefUnwindSafe for TextureAtlas
impl Send for TextureAtlas
impl Sync for TextureAtlas
impl Unpin for TextureAtlas
impl UnwindSafe for TextureAtlas
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Component for T where
T: 'static + Send + Sync,
T: 'static + Send + Sync,
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Resource for T where
T: 'static + Send + Sync,
[src]
T: 'static + Send + Sync,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,