Struct bevy_text::Text [−][src]
pub struct Text {
pub sections: Vec<TextSection>,
pub alignment: TextAlignment,
}
Fields
sections: Vec<TextSection>
alignment: TextAlignment
Implementations
pub fn with_section<S: Into<String>>(
value: S,
style: TextStyle,
alignment: TextAlignment
) -> Self
pub fn with_section<S: Into<String>>(
value: S,
style: TextStyle,
alignment: TextAlignment
) -> Self
Constructs a Text
with (initially) one section.
// basic usage
let hello_world = Text::with_section(
"hello world!".to_string(),
TextStyle {
font: font_handle.clone(),
font_size: 60.0,
color: Color::WHITE,
},
TextAlignment {
vertical: VerticalAlign::Center,
horizontal: HorizontalAlign::Center,
},
);
let hello_bevy = Text::with_section(
// accepts a String or any type that converts into a String, such as &str
"hello bevy!",
TextStyle {
font: font_handle,
font_size: 60.0,
color: Color::WHITE,
},
// you can still use Default
Default::default(),
);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Text
impl UnwindSafe for Text
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Creates Self
using data from the given World
pub fn path(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
pub fn path_mut(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn get_path_mut<T>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>> where
T: Reflect,
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more