UI component bundles derive clone (#390)

make Draw, TextStyle, and the rest of the ui components derive clone
This commit is contained in:
Hugo Lindsay 2020-08-29 19:49:39 -04:00 committed by GitHub
parent 17e7642611
commit 00be5d083e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 7 deletions

View File

@ -50,7 +50,7 @@ pub enum RenderCommand {
} }
/// A component that indicates how to draw an entity. /// A component that indicates how to draw an entity.
#[derive(Properties)] #[derive(Properties, Clone)]
pub struct Draw { pub struct Draw {
pub is_visible: bool, pub is_visible: bool,
pub is_transparent: bool, pub is_transparent: bool,

View File

@ -34,7 +34,7 @@ impl RenderPipeline {
} }
} }
#[derive(Properties)] #[derive(Properties, Clone)]
pub struct RenderPipelines { pub struct RenderPipelines {
pub pipelines: Vec<RenderPipeline>, pub pipelines: Vec<RenderPipeline>,
#[property(ignore)] #[property(ignore)]

View File

@ -15,6 +15,7 @@ use bevy_render::{
}; };
use bevy_sprite::{TextureAtlas, TextureAtlasSprite}; use bevy_sprite::{TextureAtlas, TextureAtlasSprite};
#[derive(Clone)]
pub struct TextStyle { pub struct TextStyle {
pub font_size: f32, pub font_size: f32,
pub color: Color, pub color: Color,

View File

@ -18,7 +18,7 @@ use bevy_transform::{
prelude::{Rotation, Scale, Transform, Translation}, prelude::{Rotation, Scale, Transform, Translation},
}; };
#[derive(Bundle)] #[derive(Bundle, Clone)]
pub struct NodeComponents { pub struct NodeComponents {
pub node: Node, pub node: Node,
pub style: Style, pub style: Style,
@ -62,7 +62,7 @@ impl Default for NodeComponents {
} }
} }
#[derive(Bundle)] #[derive(Bundle, Clone)]
pub struct ImageComponents { pub struct ImageComponents {
pub node: Node, pub node: Node,
pub style: Style, pub style: Style,
@ -110,7 +110,7 @@ impl Default for ImageComponents {
} }
} }
#[derive(Bundle)] #[derive(Bundle, Clone)]
pub struct TextComponents { pub struct TextComponents {
pub node: Node, pub node: Node,
pub style: Style, pub style: Style,
@ -140,7 +140,7 @@ impl Default for TextComponents {
} }
} }
#[derive(Bundle)] #[derive(Bundle, Clone)]
pub struct ButtonComponents { pub struct ButtonComponents {
pub node: Node, pub node: Node,
pub button: Button, pub button: Button,

View File

@ -1 +1,2 @@
#[derive(Clone)]
pub struct Button; pub struct Button;

View File

@ -5,6 +5,7 @@ use bevy_math::Size;
use bevy_render::texture::Texture; use bevy_render::texture::Texture;
use bevy_sprite::ColorMaterial; use bevy_sprite::ColorMaterial;
#[derive(Clone)]
pub enum Image { pub enum Image {
KeepAspect, KeepAspect,
} }

View File

@ -12,7 +12,7 @@ use bevy_sprite::TextureAtlas;
use bevy_text::{DrawableText, Font, FontAtlasSet, TextStyle}; use bevy_text::{DrawableText, Font, FontAtlasSet, TextStyle};
use bevy_transform::prelude::Transform; use bevy_transform::prelude::Transform;
#[derive(Default)] #[derive(Default, Clone)]
pub struct Text { pub struct Text {
pub value: String, pub value: String,
pub font: Handle<Font>, pub font: Handle<Font>,