2021-08-04 01:16:25 +00:00
|
|
|
use crate::{
|
|
|
|
texture_atlas::{TextureAtlas, TextureAtlasSprite},
|
|
|
|
Sprite,
|
|
|
|
};
|
2021-04-11 20:13:07 +00:00
|
|
|
use bevy_asset::Handle;
|
|
|
|
use bevy_ecs::bundle::Bundle;
|
2021-06-21 23:28:52 +00:00
|
|
|
use bevy_render2::texture::Image;
|
2021-04-11 20:13:07 +00:00
|
|
|
use bevy_transform::components::{GlobalTransform, Transform};
|
|
|
|
|
|
|
|
#[derive(Bundle, Clone)]
|
|
|
|
pub struct PipelinedSpriteBundle {
|
|
|
|
pub sprite: Sprite,
|
|
|
|
pub transform: Transform,
|
|
|
|
pub global_transform: GlobalTransform,
|
2021-06-21 23:28:52 +00:00
|
|
|
pub texture: Handle<Image>,
|
2021-04-11 20:13:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for PipelinedSpriteBundle {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
sprite: Default::default(),
|
|
|
|
transform: Default::default(),
|
|
|
|
global_transform: Default::default(),
|
|
|
|
texture: Default::default(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-04 01:16:25 +00:00
|
|
|
|
|
|
|
/// A Bundle of components for drawing a single sprite from a sprite sheet (also referred
|
|
|
|
/// to as a `TextureAtlas`)
|
|
|
|
#[derive(Bundle, Clone)]
|
|
|
|
pub struct PipelinedSpriteSheetBundle {
|
|
|
|
/// The specific sprite from the texture atlas to be drawn
|
|
|
|
pub sprite: TextureAtlasSprite,
|
|
|
|
/// A handle to the texture atlas that holds the sprite images
|
|
|
|
pub texture_atlas: Handle<TextureAtlas>,
|
|
|
|
/// Data pertaining to how the sprite is drawn on the screen
|
|
|
|
pub transform: Transform,
|
|
|
|
pub global_transform: GlobalTransform,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for PipelinedSpriteSheetBundle {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
sprite: Default::default(),
|
|
|
|
texture_atlas: Default::default(),
|
|
|
|
transform: Default::default(),
|
|
|
|
global_transform: Default::default(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|