aboutsummaryrefslogtreecommitdiff
path: root/src/grid.h
blob: 65fa01a7b39d18656b7aeb49552726910097f0f5 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef GRID_H
#define GRID_H

#include "position.h"

typedef struct Dimensions
{
	unsigned int width;
	unsigned int height;
} Dimensions;

typedef struct Grid
{
	char ***grid;
	Dimensions dimens;
} Grid;

/**
 * Returns a grid.
 *
 * @param width The grid width
 * @param height The grid height
 * @param fill A string to fill the new grid with
 */
Grid grid_create(unsigned int width, unsigned int height, char *fill);

/*
 * Returns a value from a position in a grid.
 *
 * @param grid A grid
 * @param pos A grid position
 */
char *grid_get(Grid grid, Position pos);

/*
 * Sets the value of a position in a grid.
 *
 * @param grid A grid
 * @param pos A grid position
 * @param value A new value
 */
void grid_set(Grid grid, Position pos, char *value);

/**
 * Prints a grid.
 *
 * @param grid A grid
 */
void grid_print(Grid grid);

/**
 * Destroys a grid.
 *
 * @param grid A grid
 */
void grid_destroy(Grid grid);

#endif