More refactor, exposing some interface to graphics
This commit is contained in:
@@ -45,24 +45,22 @@ impl GraphicsBuf {
|
||||
}
|
||||
});
|
||||
|
||||
self.sprite_atlas
|
||||
.draw_string(10, 10, "Hello World!", &mut gfx_buf);
|
||||
|
||||
self.sprite_atlas.draw_textfield(
|
||||
10,
|
||||
20,
|
||||
110,
|
||||
10,
|
||||
"I think this font has a *lot* of 'character'! ;)",
|
||||
&mut gfx_buf,
|
||||
);
|
||||
|
||||
draw_bresenham_line(0, 0, 127, 0, &mut gfx_buf);
|
||||
draw_bresenham_line(0, 63, 128, 63, &mut gfx_buf);
|
||||
draw_bresenham_line(0, 0, 0, 63, &mut gfx_buf);
|
||||
draw_bresenham_line(127, 0, 127, 63, &mut gfx_buf);
|
||||
}
|
||||
|
||||
pub fn draw_string(&mut self, x: u8, y: u8, string: &str) {
|
||||
self.sprite_atlas
|
||||
.draw_string(x, y, string, &mut self.buffer);
|
||||
}
|
||||
|
||||
pub fn draw_textfield(&mut self, x: u8, y: u8, width: u8, height: u8, string: &str) {
|
||||
self.sprite_atlas
|
||||
.draw_textfield(x, y, width, height, string, &mut self.buffer);
|
||||
}
|
||||
|
||||
pub fn get_px_buffer(&self) -> &[u8; 8192] {
|
||||
&self.buffer
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user