[][src]Struct a2d::TextGrid

pub struct TextGrid { /* fields omitted */ }

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]

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 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

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.