[−][src]Struct ggez::graphics::Text
Drawable text object. Essentially a list of TextFragment
's
and some cached size information.
It implements Drawable
so it can be drawn immediately with
graphics::draw()
, or many of them can be queued with graphics::queue_text()
and then all drawn at once with graphics::draw_queued_text()
.
Implementations
impl Text
[src]
pub fn new<F>(fragment: F) -> Text where
F: Into<TextFragment>,
[src]
F: Into<TextFragment>,
Creates a Text
from a TextFragment
.
let text = Text::new("foo");
pub fn add<F>(&mut self, fragment: F) -> &mut Text where
F: Into<TextFragment>,
[src]
F: Into<TextFragment>,
Appends a TextFragment
to the Text
.
pub fn fragments(&self) -> &[TextFragment]
[src]
Returns a read-only slice of all TextFragment
's.
pub fn fragments_mut(&mut self) -> &mut [TextFragment]
[src]
Returns a mutable slice with all fragments.
pub fn set_bounds<P>(&mut self, bounds: P, alignment: Align) -> &mut Text where
P: Into<Point2<f32>>,
[src]
P: Into<Point2<f32>>,
Specifies rectangular dimensions to try and fit contents inside of,
by wrapping, and alignment within the bounds. To disable wrapping,
give it a layout with f32::INF
for the x value.
pub fn set_font(&mut self, font: Font, font_scale: PxScale) -> &mut Text
[src]
Specifies text's font and font scale; used for fragments that don't have their own.
pub fn contents(&self) -> String
[src]
Returns the string that the text represents.
pub fn dimensions(&self, context: &Context) -> Rect
[src]
Returns a Rect containing the width and height of the formatted and wrapped text.
pub fn width(&self, context: &Context) -> f32
[src]
Returns the width of formatted and wrapped text, in screen coordinates.
pub fn height(&self, context: &Context) -> f32
[src]
Returns the height of formatted and wrapped text, in screen coordinates.
Trait Implementations
impl Clone for Text
[src]
impl Debug for Text
[src]
impl Default for Text
[src]
impl Drawable for Text
[src]
pub fn draw(&self, ctx: &mut Context, param: DrawParam) -> GameResult
[src]
pub fn dimensions(&self, ctx: &mut Context) -> Option<Rect>
[src]
pub fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
pub fn blend_mode(&self) -> Option<BlendMode>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Text
[src]
impl Send for Text
[src]
impl !Sync for Text
[src]
impl Unpin for Text
[src]
impl UnwindSafe for Text
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,