[][src]Struct wasm_game_lib::graphics::text::Text

pub struct Text<'a> {
    pub coords: (usize, usize),
    pub font: &'a Font,
    pub text: String,
    pub style: TextStyle<'a>,
    pub character_size: (usize, &'a str),
}

A text drawable on a Canvas.

Fields

coords: (usize, usize)

The coords of the text in px.

font: &'a Font

The font of the text.

text: String

The text.

style: TextStyle<'a>

The style of the text (bold/italic...)

character_size: (usize, &'a str)

The character_size. example: (14, "px")

Methods

impl<'a> Text<'a>[src]

pub fn new(font: &'a Font) -> Text<'a>[src]

Create a new text with default values.

pub fn new_with_text_and_coords(
    font: &'a Font,
    text: String,
    coords: (usize, usize)
) -> Text<'a>
[src]

Create a new text with some default values.

pub fn new_with_options(
    font: &'a Font,
    text: String,
    coords: (usize, usize),
    style: TextStyle<'a>,
    character_size: (usize, &'a str)
) -> Text<'a>
[src]

Create a new text with no default value.

pub fn set_text(&mut self, text: String)[src]

Set the displayed text.

pub fn set_style(&mut self, style: TextStyle<'a>)[src]

Set the style of the text.

Trait Implementations

impl<'a> Drawable for Text<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Text<'a>

impl<'a> Send for Text<'a>

impl<'a> Sync for Text<'a>

impl<'a> Unpin for Text<'a>

impl<'a> UnwindSafe for Text<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.