Crate tetrice

source ·
Expand description

This crate provides core functions of Tetris.

How to use

  1. Install this crate.
  2. Make a block kind selector.
    use tetrice::BlockKind;
    
    fn selector() -> BlockKind {
        // Return one of the kinds (probably you want to select randomly)
    }
  3. Create a game.
    use tetrice::Game;
    
    fn main() {
        // Create a game which has a 10x20 field and provides 3 next tetriminos
        let mut game = Game::new(10, 20, 3, Box::new(selector));
    
        // Now you can move, rotate, etc. using `game`!
    }

Structs

Checks the state of a tetrimino, for example whether it touches to another block.
A game field.
A game manager.
A tetrimino consisting of four dropping blocks.

Enums

The block kind of a tetrimino.
A state of cells in the field.