FreeRTOS Tetris
Data Structures | Macros | Typedefs | Functions
logic.h File Reference

Header file for logic.c. More...

#include "tetrisConfig.h"
Include dependency graph for logic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tetromino
 Structure representing a Tetromino. More...
 
struct  score
 Structure for the score. More...
 

Macros

#define EMPTY_SPACE   0
 If an tetromino does not contain a block in specific position, the value is set to 0.
 
Initial coordinates
#define INIT_COORDS_X   COLS/2 -1
 Initial x coordinate.
 
#define INIT_COORDS_Y   0
 Initial y coordinate.
 
Pressed keys
#define LEFT_PRESSED   1
 Left-arrow key.
 
#define RIGHT_PRESSED   2
 Right-arrow key.
 
#define DOWN_PRESSED   3
 Down-arrow key.
 

Typedefs

typedef struct tetromino tetromino_t
 Structure representing a Tetromino.
 
typedef struct score score_t
 Structure for the score.
 

Functions

void vLogicInitTetromino (tetromino_t *tetromino, tetromino_type_t types[], int *index, player_mode_t playerMode)
 Initialize a Tetromino. More...
 
bool bLogicCheckMove (const color_t newShape[FIGURE_SIZE][FIGURE_SIZE], coord_t newPosition, const color_t landed[ROWS][COLS])
 Check if a move to a newPosition is possible. More...
 
bool bLogicCheckGameOver (const tetromino_t *tetromino, const color_t landed[ROWS][COLS])
 Check if the game will be over if the new tetromino is created. More...
 
void vLogicUpdateXCoord (tetromino_t *tetromino, const color_t landed[ROWS][COLS], int pressedButton)
 Update the x coordinate of tetromino. More...
 
bool bLogicUpdateYCoord (tetromino_t *tetromino, const color_t landed[ROWS][COLS])
 Update the y coordinate of tetromino. More...
 
void vLogicRotate (tetromino_t *tetromino, const color_t landed[ROWS][COLS], rotation_t rotationMode)
 Rotate tetromino, if possible. More...
 
void vLogicAddToLanded (const tetromino_t *tetromino, color_t landed[ROWS][COLS])
 Add tetromino to the landed array. More...
 
bool vLogicRowFull (color_t landed[ROWS][COLS], score_t *score)
 Check how many rows are full and remove them. More...
 

Detailed Description

Header file for logic.c.

Authors
Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
Date
04.02.2021