pub struct Text { /* private fields */ }
Expand description
UI (on-screen) text.
To use, create the new one using Factory::ui_text
and add it to the scene using Scene::add
.
Implementations§
Source§impl Text
impl Text
Sourcepub fn set_pos<P: Into<Point2<f32>>>(&mut self, point: P)
pub fn set_pos<P: Into<Point2<f32>>>(&mut self, point: P)
Change text position. Coordinates in pixels from top-left. Defaults to (0, 0).
Sourcepub fn set_size<V: Into<Vector2<f32>>>(&mut self, dimensions: V)
pub fn set_size<V: Into<Vector2<f32>>>(&mut self, dimensions: V)
Change maximum bounds size, in pixels from top-left. Defaults to unbound.
Sourcepub fn set_opacity(&mut self, opacity: f32)
pub fn set_opacity(&mut self, opacity: f32)
Change text opacity.
From 0.0
to 1.0
.
Defaults to 1.0
.
Sourcepub fn set_font_size(&mut self, size: f32)
pub fn set_font_size(&mut self, size: f32)
Change font size (scale). Defaults to 16.
Sourcepub fn set_layout(&mut self, layout: Layout)
pub fn set_layout(&mut self, layout: Layout)
Change text layout.
Defaults to Layout::SingleLine(Align::Left)
.
Trait Implementations§
Source§impl DowncastObject for Text
impl DowncastObject for Text
Source§fn downcast(object: ObjectType) -> Option<Self>
fn downcast(object: ObjectType) -> Option<Self>
Attempts to extract the concrete type of the object from an
ObjectType
. Read moreSource§impl Object for Text
impl Object for Text
Source§fn resolve_data(&self, _: &SyncGuard<'_>) -> Self::Data
fn resolve_data(&self, _: &SyncGuard<'_>) -> Self::Data
Retrieves the internal data for the object. Read more
Source§fn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Invisible objects are not rendered by cameras.
Source§fn set_transform<P, Q>(&self, pos: P, rot: Q, scale: f32)
fn set_transform<P, Q>(&self, pos: P, rot: Q, scale: f32)
Set both position, orientation and scale.
Source§fn set_orientation<Q>(&self, rot: Q)
fn set_orientation<Q>(&self, rot: Q)
Set orientation.
Source§fn set_weights(&self, weights: Vec<f32>)
fn set_weights(&self, weights: Vec<f32>)
Set weights.
impl Eq for Text
impl StructuralPartialEq for Text
Auto Trait Implementations§
impl Freeze for Text
impl !RefUnwindSafe for Text
impl !Send for Text
impl !Sync for Text
impl Unpin for Text
impl !UnwindSafe for Text
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more