Brick Game v1.0
Implementation of the game Tetris in the C programming language with a terminal user interface.
Loading...
Searching...
No Matches
utils.h
1#ifndef BRICK_GAME_V1_0_BRICK_GAME_TETRIS_UTILS_H_
2#define BRICK_GAME_V1_0_BRICK_GAME_TETRIS_UTILS_H_
3
4#include <stdlib.h>
5
6#define MAX(A, B) ((A) >= (B) ? (A) : (B))
7#define MIN(A, B) ((A) <= (B) ? (A) : (B))
8
10static inline void array2d_to_matrix(int *array, int rows, int cols, int **matrix) {
11 for (int i = 0; i < rows; i += 1) {
12 matrix[i] = &array[(size_t)i * (size_t)cols];
13 }
14}
15
16#endif // BRICK_GAME_V1_0_BRICK_GAME_TETRIS_UTILS_H_