From 462c1f8bf195a1e30b6c05be7a0ec60ee89d230c Mon Sep 17 00:00:00 2001 From: curly Date: Mon, 15 Aug 2022 15:49:56 -0600 Subject: half working --- src/display.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/display.rs') diff --git a/src/display.rs b/src/display.rs index c3791f8..b57f68f 100644 --- a/src/display.rs +++ b/src/display.rs @@ -1,5 +1,21 @@ -pub fn display(grid: &Vec>) { +use crate::tetris::piece::{Piece, Pos}; + +pub fn display(grid: &Vec>, piece: &Piece) { + let piece_pos_vec = piece.get_bits_pos(); + + let mut yc = 0; for y in grid { - println!("{:?}", y); + let mut xc = 0; + for mut x in y { + for bit in &piece_pos_vec { + if bit == &Pos(yc, xc) { + x = &1; + } + } + xc += 1; + print!("{} ", x); + } + print!("\n"); + yc += 1; } } \ No newline at end of file -- cgit v1.2.3