pub trait Backend {
// Required methods
fn width(&self) -> u32;
fn height(&self) -> u32;
fn fill_rect(&mut self, x: u32, y: u32, w: u32, h: u32, color: Color);
fn present(&mut self);
fn poll_event(&mut self) -> Option<Event>;
// Provided methods
fn draw_char(&mut self, x: u32, y: u32, ch: char, color: Color) { ... }
fn draw_text(&mut self, x: u32, y: u32, text: &str, color: Color) { ... }
fn hline(&mut self, x: u32, y: u32, w: u32, color: Color) { ... }
fn vline(&mut self, x: u32, y: u32, h: u32, color: Color) { ... }
fn draw_rect(&mut self, x: u32, y: u32, w: u32, h: u32, color: Color) { ... }
fn clear(&mut self, color: Color) { ... }
fn size(&self) -> (u32, u32) { ... }
}Required Methods§
Sourcefn fill_rect(&mut self, x: u32, y: u32, w: u32, h: u32, color: Color)
fn fill_rect(&mut self, x: u32, y: u32, w: u32, h: u32, color: Color)
Fill a rectangle with a solid color. Out-of-bounds coordinates should be clipped silently.
Sourcefn poll_event(&mut self) -> Option<Event>
fn poll_event(&mut self) -> Option<Event>
Return the next pending input event, or None if the queue is empty.
Provided Methods§
Sourcefn draw_char(&mut self, x: u32, y: u32, ch: char, color: Color)
fn draw_char(&mut self, x: u32, y: u32, ch: char, color: Color)
Draw a single character at (x, y) using the embedded bitmap font.
Sourcefn draw_text(&mut self, x: u32, y: u32, text: &str, color: Color)
fn draw_text(&mut self, x: u32, y: u32, text: &str, color: Color)
Draw a string at (x, y) advancing by font::CHAR_W per glyph.