1
#ifndef __GAME_MATRIX__
2
#define __GAME_MATRIX__
11
#include "DynamicArray.h"
14
* A SMatrix is a 2d, square array.
16
typedef struct _SMatrix SMatrix;
20
s_matrix_new (size_t width, size_t height);
23
s_matrix_free (SMatrix * self, bool free_data);
26
* Reallocate a SMatrix from one tuple width to an other.
28
* @note The new tupel size must be larger then the laset, or it will be
31
* @note You need to free the old SMatrix yourself, this is to avoid memory
35
s_matrix_realloc (SMatrix * self, size_t width);
38
* Get element y in tuple x.
40
* Equivilant to matrix[x][y] wolud be in static 2d arrays.
43
s_matrix_get (SMatrix * self, size_t x, size_t y);
46
s_matrix_set (SMatrix * self, size_t x, size_t y, spointer data);
49
s_matrix_get_tupel (SMatrix * self, size_t x);
52
s_matrix_append (SMatrix * self, spointer data);
55
s_matrix_get_tupel_as_dynamic_array (SMatrix * self, size_t x);
58
* This itterates over each tuple. giving the tuple as the item in the
62
s_matrix_foreach (SMatrix * self, ForEachFunc callback, spointer data);
64
#endif /*__GAME_MATRIX__ */