pub enum RotationSystem {
Raw,
Ocular,
ClassicL,
ClassicR,
Super,
}Expand description
Handles the logic of how to rotate a tetromino in play.
Variants§
Raw
The raw rotation system resulting from simply reorienting the internal piece representation.
This can be seen as a debug implementation.
The rotation itself looks similar to RotationSystem::ClassicL.
Ocular
The ‘Ocular’ rotation system.
ClassicL
The left-handed variant of the classic, kick-less rotation system, e.g. used in the Gameboy version.
ClassicR
The right-handed variant of the classic, kick-less rotation system, e.g. used in the NES version.
Super
The Super Rotation System.
Implementations§
Source§impl RotationSystem
impl RotationSystem
Sourcepub fn rotate(
&self,
piece: &Piece,
board: &Board,
right_turns: i8,
) -> Option<Piece>
pub fn rotate( &self, piece: &Piece, board: &Board, right_turns: i8, ) -> Option<Piece>
Tries to rotate a piece with the chosen RotationSystem.
This will return Ok(new_piece) if the old_piece, when rotated
right_turns-times from its position, fit onto the board, ending up as new_piece;
It will return None if not.
In particular, rotating a piece 0 times tests whether piece fits in its current position.
Trait Implementations§
Source§impl Clone for RotationSystem
impl Clone for RotationSystem
Source§fn clone(&self) -> RotationSystem
fn clone(&self) -> RotationSystem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more