draw_text

Function draw_text 

Source
pub fn draw_text<S: AsRef<str>, I: Into<Vec2Int>>(
    ctx: &mut Context,
    text: S,
    font: &str,
    size: u16,
    pos: I,
    mode: TextMode,
) -> Result<()>
Expand description

Draw text to the screen.

This loads a font from the current directory, case sensitive.

pos refers to the center of the rendered text.

Refer to TextMode for information about colouring.

let mode = TextMode::Shaded {
    foreground: (255, 255, 255),
    background: (0, 0, 0)
};
draw_text(ctx, "text to draw", "arial.ttf", 72, (300, 300), mode);