(&mut self, ctx: &mut Context)
| 61 | } |
| 62 | |
| 63 | pub fn draw(&mut self, ctx: &mut Context) { |
| 64 | for (i, cell) in self.cells.iter().enumerate() { |
| 65 | let (x, y) = (i % self.width, i / self.width); |
| 66 | let sprite_x = (219 / 16) as f32 * 8.0; |
| 67 | let sprite_y = (219 % 16) as f32 * 8.0; |
| 68 | |
| 69 | if cell.background != Color::BLACK { |
| 70 | self.font.draw_region( |
| 71 | ctx, |
| 72 | Rectangle::new(sprite_x, sprite_y, 8.0, 8.0), |
| 73 | DrawParams::new() |
| 74 | .position(Vec2::new( |
| 75 | self.cell_size * x as f32, |
| 76 | self.cell_size * y as f32, |
| 77 | )) |
| 78 | .color(cell.background), |
| 79 | ); |
| 80 | } |
| 81 | |
| 82 | if cell.glyph != ' ' { |
| 83 | let codepoint = cell.glyph as u8; |
| 84 | let sprite_x = f32::from(codepoint / 16) * 8.0; |
| 85 | let sprite_y = f32::from(codepoint % 16) * 8.0; |
| 86 | |
| 87 | self.font.draw_region( |
| 88 | ctx, |
| 89 | Rectangle::new(sprite_x, sprite_y, 8.0, 8.0), |
| 90 | DrawParams::new() |
| 91 | .position(Vec2::new( |
| 92 | self.cell_size * x as f32, |
| 93 | self.cell_size * y as f32, |
| 94 | )) |
| 95 | .color(cell.foreground), |
| 96 | ); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
nothing calls this directly
no outgoing calls
no test coverage detected