swoop_ui/text/
swoop_text.rs1use bevy_color::prelude::*;
2use bevy_ecs::prelude::*;
3use bevy_math::prelude::*;
4use bevy_ui::prelude::*;
5
6use crate::View;
7use crate::background::BackgroundStyle;
8use crate::border::{BorderStyle, BorderView};
9use crate::prelude::{BackgroundView, PositionView};
10use crate::shadow::{BoxShadowView, TextShadowView};
11
12use super::{TextStyle, TextView};
13
14pub type SText = SwoopText;
15
16#[derive(Bundle, Debug, Clone)]
22pub struct SwoopText {
23 name: Name,
25
26 node: Node,
28
29 border: BorderStyle,
31
32 background: BackgroundStyle,
34
35 box_shadow: BoxShadow,
37
38 text: TextStyle,
40
41 text_shadow: TextShadow,
43}
44
45impl Default for SwoopText {
46 fn default() -> Self {
48 Self {
49 name: Name::new("SwoopText"),
50 node: Node {
51 ..Default::default()
52 },
53 border: BorderStyle::default(),
54 background: BackgroundStyle::default(),
55 box_shadow: BoxShadow::default(),
56 text: TextStyle::default(),
57 text_shadow: TextShadow {
58 offset: Vec2::ZERO,
59 color: Srgba::NONE.into(),
60 },
61 }
62 }
63}
64
65impl View for SwoopText {
66 fn name_node(&mut self) -> &mut Name {
67 &mut self.name
68 }
69
70 fn node_node(&mut self) -> &mut Node {
71 &mut self.node
72 }
73}
74
75impl BorderView for SwoopText {
76 fn border_node(&mut self) -> &mut BorderStyle {
77 &mut self.border
78 }
79}
80
81impl BackgroundView for SwoopText {
82 fn background_node(&mut self) -> &mut BackgroundStyle {
83 &mut self.background
84 }
85}
86
87impl BoxShadowView for SwoopText {
88 fn box_shadow_node(&mut self) -> &mut BoxShadow {
89 &mut self.box_shadow
90 }
91}
92
93impl TextView for SwoopText {
94 fn text_node(&mut self) -> &mut super::TextStyle {
95 &mut self.text
96 }
97}
98
99impl TextShadowView for SwoopText {
100 fn text_shadow_node(&mut self) -> &mut TextShadow {
101 &mut self.text_shadow
102 }
103}
104
105impl PositionView for SwoopText {}