// A game is a self-contained struct that holds everything that an instance of // Tetris needs to run, except for something to tick the time forward. use crate::playfield::PlayField; use crate::srs::RotationSystem; use crate::srs::SRS; pub struct Game { playfield: PlayField, rotation_system: RS, level: u8, points: u64, } impl Default for Game { fn default() -> Self { Game { playfield: PlayField::new(), rotation_system: RS::default(), level: 0, points: 0, } } } trait Controllable { fn move_left(&mut self); fn move_up(&mut self); fn move_right(&mut self); fn move_down(&mut self); fn rotate_left(&mut self); fn rotate_right(&mut self); fn hard_drop(&mut self); fn hold(&mut self); } impl Controllable for Game { fn move_left(&mut self) {} fn move_up(&mut self) {} fn move_right(&mut self) {} fn move_down(&mut self) {} fn rotate_left(&mut self) {} fn rotate_right(&mut self) {} fn hard_drop(&mut self) {} fn hold(&mut self) { // if self.can_swap_hold { // match self.hold_piece { // None => { // self.hold_piece = Some(self.active_piece); // self.get_new_piece(); // } // Some(piece) => { // self.hold_piece = Some(self.active_piece); // self.active_piece = piece; // self.reset_position(); // } // } // self.can_swap_hold = false; // } } }