[−][src]Struct yagl::TextGrid
Convenience struct for drawing text on the screen. Currently, functionality is pretty limited: * only able to use the Courier font bundled with A2D, * only ASCII text is supported
Implementations
impl TextGrid
[src]
pub const CHAR_WIDTH_TO_HEIGHT_RATIO: f32
[src]
The width to height ratio of each drawn character rectangle
pub const PADDING_FACTOR: [f32; 2]
[src]
The ratio to trim off each of the source rectangles so that the borders are not included in the draw
pub fn char_width(&self) -> f32
[src]
The width of a single character cell
pub fn char_height(&self) -> f32
[src]
The height of a single character cell
pub fn char_dim(&self) -> Dimensions
[src]
pub fn rect_for_coord(&self, row_col: [u32; 2]) -> Rect
[src]
Gives the rectangle coordinates of where the character at given row and column is drawn
pub fn write_str(&mut self, coord: [u32; 2], s: &str)
[src]
pub fn write_color_str<C>(&mut self, coord: [u32; 2], s: &str, color: C) where
C: Into<Color>,
[src]
C: Into<Color>,
Writes the given string to this grid starting at the given row and column This method will not wrap the string
pub fn write_ch(&mut self, coord: [u32; 2], ch: char)
[src]
pub fn write_color_ch<C>(&mut self, coord: [u32; 2], ch: char, color: C) where
C: Into<Color>,
[src]
C: Into<Color>,
pub fn set_color<C>(&mut self, coord: [u32; 2], color: C) where
C: Into<Color>,
[src]
C: Into<Color>,
pub fn nrows(&self) -> u32
[src]
Returns the number of rows in this TextGrid
pub fn ncols(&self) -> u32
[src]
Returns the number of columns in this TextGrid
pub fn dimensions(&self) -> [u32; 2]
[src]
Returns the [nrows, ncols] dimensions of this TextGrid
pub fn batch(&self) -> &SpriteBatch
[src]
Get the underlying SpriteBatch associated with this TextGrid
pub fn set_translation(&mut self, translation: [f32; 2])
[src]
pub fn translation(&self) -> [f32; 2]
[src]
Auto Trait Implementations
impl !RefUnwindSafe for TextGrid
impl !Send for TextGrid
impl !Sync for TextGrid
impl Unpin for TextGrid
impl !UnwindSafe for TextGrid
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,
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> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
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.
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>,