Brick Game v1.0
Implementation of the game Tetris in the C programming language with a terminal user interface.
Loading...
Searching...
No Matches
piece.h File Reference

Defines pieces and operations on them. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PieceData
 An array of blocks the piece consists of. More...
 
struct  PlayedPiece
 State of the currently played piece. More...
 

Macros

#define PIECE_ROWS   4
 Number of rows in PieceData::blocks.
 
#define PIECE_COLS   4
 Number of columns in PieceData::blocks.
 
#define PIECE_TYPE_COUNT   7
 

Enumerations

enum  PieceType {
  O_PIECE = 0 , I_PIECE = 1 , S_PIECE = 2 , Z_PIECE = 3 ,
  J_PIECE = 4 , L_PIECE = 5 , T_PIECE = 6
}
 Possible piece types.
 

Functions

PieceData get_piece_data (PieceType piece_type, int rotation)
 Get the block data from piece type and rotation.
 
int piece_spawn_height_offset (PieceType piece_type)
 Get the offset at which we should spawn the piece on the field.
 

Detailed Description

Defines pieces and operations on them.

Function Documentation

◆ piece_spawn_height_offset()

int piece_spawn_height_offset ( PieceType  piece_type)

Get the offset at which we should spawn the piece on the field.

The offset should be such, that in the default orientation the piece occupies the top row of the field