diff options
author | curly <curlybryce@protonmail.com> | 2022-08-15 15:49:56 -0600 |
---|---|---|
committer | curly <curlybryce@protonmail.com> | 2022-08-15 15:49:56 -0600 |
commit | 462c1f8bf195a1e30b6c05be7a0ec60ee89d230c (patch) | |
tree | 6965d94cfaabecef461597cf8de4b30cc225cfdc /src/display.rs | |
parent | 008c2b23c78f8969c9741e537326c13b98c27b58 (diff) | |
download | tetris-462c1f8bf195a1e30b6c05be7a0ec60ee89d230c.tar.gz tetris-462c1f8bf195a1e30b6c05be7a0ec60ee89d230c.tar.bz2 tetris-462c1f8bf195a1e30b6c05be7a0ec60ee89d230c.zip |
half working
Diffstat (limited to 'src/display.rs')
-rw-r--r-- | src/display.rs | 20 |
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 |