aboutsummaryrefslogtreecommitdiff
path: root/src/display.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/display.rs')
-rw-r--r--src/display.rs20
1 files changed, 18 insertions, 2 deletions
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<Vec<i8>>) {
+use crate::tetris::piece::{Piece, Pos};
+
+pub fn display(grid: &Vec<Vec<i8>>, 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