From b174559a68f1421cc306495ac4aaae3598c35b97 Mon Sep 17 00:00:00 2001 From: Able Date: Sun, 28 Nov 2021 22:00:58 -0600 Subject: [PATCH] Worked on text rendering --- src/graphics_api_impl.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/graphics_api_impl.rs b/src/graphics_api_impl.rs index e951554..f0f07e9 100644 --- a/src/graphics_api_impl.rs +++ b/src/graphics_api_impl.rs @@ -87,16 +87,15 @@ impl AglApi for GraphicsRenderer { .with_scale_and_position(scale as f32, point(coords.x as f32, coords.y as f32)); // Draw it. if let Some(q) = font.outline_glyph(q_glyph) { + // dbg!(q); + q.draw(|x, y, c| { /* draw pixel `(x, y)` with coverage: `c` */ - println!("h"); - self.put_pixel( - Point { - x: x as u16, - y: y as u16, - }, - color, - ); + dbg!(x, y, c); + + let coordinates = x as u16 + (WIDTH as u16).wrapping_mul(y as u16); + + self.buff[coordinates as usize] = color; }); } }