Struct ggez::graphics::TextCached [−][src]
pub struct TextCached { /* fields omitted */ }
Drawable text. Can be either monolithic, or consist of differently-formatted fragments.
Methods
impl TextCached
[src]
impl TextCached
pub fn new<F>(fragment: F) -> GameResult<TextCached> where
F: Into<TextFragment>,
[src]
pub fn new<F>(fragment: F) -> GameResult<TextCached> where
F: Into<TextFragment>,
Creates a TextCached
from a TextFragment
.
pub fn new_empty() -> GameResult<TextCached>
[src]
pub fn new_empty() -> GameResult<TextCached>
Creates an empty TextCached
.
pub fn add_fragment<F>(&mut self, fragment: F) -> &mut TextCached where
F: Into<TextFragment>,
[src]
pub fn add_fragment<F>(&mut self, fragment: F) -> &mut TextCached where
F: Into<TextFragment>,
Appends a TextFragment
.
pub fn replace_fragment<F>(
&mut self,
old_index: usize,
new_fragment: F
) -> &mut TextCached where
F: Into<TextFragment>,
[src]
pub fn replace_fragment<F>(
&mut self,
old_index: usize,
new_fragment: F
) -> &mut TextCached where
F: Into<TextFragment>,
Replaces a TextFragment
without having to rebuild the entire TextCached
.
Useful for things like animating specific words, or highlighting them on mouseover.
pub fn fragments(&self) -> &[TextFragment]
[src]
pub fn fragments(&self) -> &[TextFragment]
Returns a slice with all fragments, for reading.
pub fn set_bounds(
&mut self,
bounds: Point2,
layout: Option<Layout>
) -> &mut TextCached
[src]
pub fn set_bounds(
&mut self,
bounds: Point2,
layout: Option<Layout>
) -> &mut TextCached
Specifies rectangular dimensions to try and fit contents inside of, by wrapping.
Alignment within bounds can be changed by passing a Layout
; defaults to top left corner.
pub fn set_font<FI>(
&mut self,
font_id: FI,
font_scale: Scale
) -> &mut TextCached where
FI: Into<FontId>,
[src]
pub fn set_font<FI>(
&mut self,
font_id: FI,
font_scale: Scale
) -> &mut TextCached where
FI: Into<FontId>,
Specifies text's font and font scale; used for fragments that don't have their own.
pub fn contents(&self) -> String
[src]
pub fn contents(&self) -> String
Returns the string that the text represents.
pub fn width(&self, context: &Context) -> u32
[src]
pub fn width(&self, context: &Context) -> u32
Returns the width of formatted and wrapped text, in screen coordinates.
pub fn height(&self, context: &Context) -> u32
[src]
pub fn height(&self, context: &Context) -> u32
Returns the height of formatted and wrapped text, in screen coordinates.
pub fn queue(
&self,
context: &mut Context,
relative_dest: Point2,
color: Option<Color>
)
[src]
pub fn queue(
&self,
context: &mut Context,
relative_dest: Point2,
color: Option<Color>
)
Queues the TextCached
to be drawn by draw_queued()
.
relative_dest
is relative to the DrawParam::dest
passed to draw_queued()
.
Note, any TextCached
drawn via graphics::draw()
will also draw the queue.
pub fn queue_raw<'a, S, G>(
context: &mut Context,
section: S,
custom_layout: Option<&G>
) where
S: Into<Cow<'a, VariedSection<'a>>>,
G: GlyphPositioner,
[src]
pub fn queue_raw<'a, S, G>(
context: &mut Context,
section: S,
custom_layout: Option<&G>
) where
S: Into<Cow<'a, VariedSection<'a>>>,
G: GlyphPositioner,
Exposes gfx_glyph
's GlyphBrush::queue()
and GlyphBrush::queue_custom_layout()
,
in case ggez
' API is insufficient.
pub fn draw_queued<D>(context: &mut Context, param: D) -> GameResult<()> where
D: Into<DrawParam>,
[src]
pub fn draw_queued<D>(context: &mut Context, param: D) -> GameResult<()> where
D: Into<DrawParam>,
Draws all of queue()
d TextCached
.
DrawParam
apply to everything in the queue; offset is in screen coordinates;
color is ignored - specify it when queue()
ing instead.
Trait Implementations
impl Debug for TextCached
[src]
impl Debug for TextCached
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for TextCached
[src]
impl Clone for TextCached
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for TextCached
[src]
impl Default for TextCached
impl Drawable for TextCached
[src]
impl Drawable for TextCached
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
[src]
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
Actually draws the object to the screen. Read more
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
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]
fn get_blend_mode(&self) -> Option<BlendMode>
Gets the blend mode to be used when drawing this drawable.
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
[src]
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
Draws the drawable onto the rendering target. Read more
Auto Trait Implementations
impl Send for TextCached
impl Send for TextCached
impl Sync for TextCached
impl Sync for TextCached