pub struct Text<T: AsRef<[u8]>> { /* private fields */ }
Expand description
A text drawing helper.
Example
use wasm4_sx::*;
#[no_mangle]
fn update() {
Text::new("Top left")
.with_horizontal_alignment(TextHorizontalAlignment::Left)
.with_vertical_alignment(TextVerticalAligment::Top)
.draw();
Text::new("Middle center")
.with_horizontal_alignment(TextHorizontalAlignment::Center)
.with_vertical_alignment(TextVerticalAligment::Middle)
.draw();
Text::new("Bottom right")
.with_horizontal_alignment(TextHorizontalAlignment::Right)
.with_vertical_alignment(TextVerticalAligment::Bottom)
.draw();
}
Implementations§
source§impl<T: AsRef<[u8]>> Text<T>
impl<T: AsRef<[u8]>> Text<T>
sourcepub fn with_padding_x(self, padding_x: i32) -> Self
pub fn with_padding_x(self, padding_x: i32) -> Self
Set the X padding.
sourcepub fn with_padding_y(self, padding_y: i32) -> Self
pub fn with_padding_y(self, padding_y: i32) -> Self
Set the Y padding.
sourcepub fn with_horizontal_alignment(
self,
alignment: TextHorizontalAlignment
) -> Self
pub fn with_horizontal_alignment( self, alignment: TextHorizontalAlignment ) -> Self
Set the horizontal alignment.
sourcepub fn with_vertical_alignment(self, alignment: TextVerticalAligment) -> Self
pub fn with_vertical_alignment(self, alignment: TextVerticalAligment) -> Self
Set the vertical alignment.
sourcepub fn with_line_separation(self, line_separation: i32) -> Self
pub fn with_line_separation(self, line_separation: i32) -> Self
Set the line separation value.
Auto Trait Implementations§
impl<T> RefUnwindSafe for Text<T>where T: RefUnwindSafe,
impl<T> Send for Text<T>where T: Send,
impl<T> Sync for Text<T>where T: Sync,
impl<T> Unpin for Text<T>where T: Unpin,
impl<T> UnwindSafe for Text<T>where T: UnwindSafe,
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