alexandercampbell / simple

The simplest Rust graphics library, inspired by LOVE2D.
https://crates.io/crates/simple
29 stars 5 forks source link

Text Drawing Support #10

Closed alexandercampbell closed 9 years ago

alexandercampbell commented 9 years ago

This library needs support for text drawing functions.

// use the default font
app.print("Monday", 32, 96);

// load a different font
let font = simple::Font::from_file(Path::new("my_font.ttf"));
app.set_font(font);
app.print("Monday", 64, 96);

// Wrap text inside of a rect.
// this will probably end up looking like
//
//  Monday is my
//  favorite day
//  of the entire
//  week!
//
app.print_rect("Monday is my favorite day of the entire week!", simple::Rect{
    x: 96,
    y: 96,
    w: 128,
    h: 512,
})
alexandercampbell commented 9 years ago

TTF is annoying for several reasons and would require the addition of another C library dependency: sdl_ttf. Instead, I'm planning on implementing a loader for the ImageFont format that LOVE2D supports.