-
Notifications
You must be signed in to change notification settings - Fork 0
/
grid.h
40 lines (34 loc) · 1.09 KB
/
grid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef GRID_H
#define GRID_H
#include <raylib.h>
typedef struct {
char character;
Color fgColor;
Color bgColor;
bool hasCharacter;
} Cell;
typedef struct {
int rows;
int cols;
int cellWidth;
int cellHeight;
Cell **cells;
} Grid;
extern Grid cellGrid;
extern bool showGrid;
extern int verticalSpacing;
extern int horizontalSpacing;
extern float textScale;
extern float cellScale;
void initGrid(Grid *grid, int rows, int cols, int cellWidth, int cellHeight);
void drawGrid(const Grid *grid, Font font);
void setCell(Grid *grid, int row, int col, char character, Color fgColor, Color bgColor);
void clearGrid(Grid *grid);
void freeGrid(Grid *grid);
void setCellBackgroundColor(Grid *grid, int row, int col, Color bgColor);
void setCellForegroundColor(Grid *grid, int row, int col, Color fgColor);
void setCellCharacter(Grid *grid, int row, int col, char character);
char getCellCharacter(const Grid *grid, int row, int col);
Color getCellBackgroundColor(const Grid *grid, int row, int col);
Color getCellForegroundColor(const Grid *grid, int row, int col);
#endif // GRID_H