Struct ggez::graphics::Text
[−]
[src]
pub struct Text { /* fields omitted */ }
Drawable text created from a Font
.
Methods
impl Text
[src]
pub fn new(context: &mut Context, text: &str, font: &Font) -> GameResult<Text>
[src]
Renders a new Text
from the given Font
.
Note that this is relatively computationally expensive; if you want to draw text every frame you probably want to save it and only update it when the text changes.
pub fn width(&self) -> u32
[src]
Returns the width of the rendered text, in pixels.
pub fn height(&self) -> u32
[src]
Returns the height of the rendered text, in pixels.
pub fn contents(&self) -> &str
[src]
Returns the string that the text represents.
pub fn get_dimensions(&self) -> Rect
[src]
Returns the dimensions of the rendered text.
pub fn get_filter(&self) -> FilterMode
[src]
Get the filter mode for the the rendered text.
pub fn set_filter(&mut self, mode: FilterMode)
[src]
Set the filter mode for the the rendered text.
pub fn get_image(&self) -> &Image
[src]
Returns a reference to the Image
contained
by the Text
object.
pub fn get_image_mut(&mut self) -> &mut Image
[src]
Returns a mutable reference to the Image
contained
by the Text
object.
pub fn into_inner(self) -> Image
[src]
Unwraps the Image
contained
by the Text
object.
Trait Implementations
impl Clone for Text
[src]
fn clone(&self) -> Text
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Drawable for Text
[src]
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
[src]
Actually draws the object to the screen. Read more
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
Sets the blend mode to be used when drawing this drawable. This overrides the general graphics::set_blend_mode()
. If None
is set, defers to the blend mode set by graphics::set_blend_mode()
. Read more
fn get_blend_mode(&self) -> Option<BlendMode>
[src]
Gets the blend mode to be used when drawing this drawable.
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
[src]
Draws the drawable onto the rendering target. Read more