Crate bevy_sprite
source ·Expand description
Provides 2D sprite rendering functionality.
Modules
Structs
- Struct defining a
Sprite
border with padding values - A 2d material that renders 2d meshes with a texture tinted by a uniform color
- The GPU representation of the uniform data of a
ColorMaterial
. - Helper utility to update
TextureAtlasLayout
on the fly. - Render pipeline data for a given
Material2d
- Adds the necessary ECS resources and render logic to enable rendering entities using the given
Material2d
asset type (which includesMaterial2d
types). - A component bundle for entities with a
Mesh2dHandle
and aMaterial2d
. - Component for rendering with meshes in the 2d pipeline, usually with a 2d material such as
ColorMaterial
. - All
Material2d
values of a given type that should be prepared next frame. - Data prepared for a
Material2d
instance. - Stores all prepared representations of
Material2d
assets for as long as they exist. - Specifies the rendering properties of a sprite.
- A
Bundle
of components for drawing a single sprite from an image. - Adds support for 2D sprite rendering.
- A
Bundle
of components for drawing a single sprite from a sprite sheet (also referred to as aTextureAtlas
) or for animated sprites. - Component used to draw a specific section of a texture.
- A builder which is used to create a texture atlas from many individual sprites.
- Stores a map used to lookup the position of a texture in a
TextureAtlas
. This can be used to either use and look up a specific section of a texture, or animate frame-by-frame as a sprite sheet. - Single texture slice, representing a texture rect to draw in a given area
- Slices a texture using the 9-slicing technique. This allows to reuse an image at various sizes without needing to prepare multiple assets. The associated texture will be split into nine portions, so that on resize the different portions scale or tile in different ways to keep the texture in proportion.
Enums
- How a sprite is positioned relative to its
Transform
. It defaults toAnchor::Center
. - Controls how the image is altered when scaled.
- Defines how a texture slice scales when resized
- System set for sprite rendering.
Constants
Traits
- Materials are used alongside
Material2dPlugin
andMaterialMesh2dBundle
to spawn entities that are rendered with a specificMaterial2d
type. They serve as an easy to use high level way to renderMesh2dHandle
entities with custom shader logic.
Functions
- System calculating and inserting an
Aabb
component to entities with either: - This system extracts all created or modified assets of the corresponding
Material2d
type into the “render world”. - This system prepares all assets of the corresponding
Material2d
type which where extracted this frame for the GPU.
Type Aliases
- A component bundle for entities with a
Mesh2dHandle
and aColorMaterial
. RenderCommand
for sprite rendering.