Skip to content

Commit

Permalink
Added clear function to 2d array.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte committed Feb 27, 2024
1 parent 6dea426 commit d1622f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions seika/data_structures/ska_array2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ void ska_array2d_resize(SkaArray2D* array2d, size_t newX, size_t newY) {
}
}

void ska_array2d_clear(SkaArray2D* array2d) {
ska_array2d_resize(array2d, 0, 0);
}

void ska_array2d_reset(SkaArray2D* array2d) {
ska_array2d_reset_default(array2d, NULL);
}
Expand Down
3 changes: 3 additions & 0 deletions seika/data_structures/ska_array2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ void ska_array2d_destroy(SkaArray2D* array2d);
void* ska_array2d_get(SkaArray2D* array2d, size_t x, size_t y);
bool ska_array2d_set(SkaArray2D* array2d, size_t x, size_t y, void* newValue);
void ska_array2d_resize(SkaArray2D* array2d, size_t newX, size_t newY);
void ska_array2d_clear(SkaArray2D* array2d);
// Maintains elements in the arrays but zeroes out data
void ska_array2d_reset(SkaArray2D* array2d);
// Maintains elements in the arrays but copy memory from the passed in default value
void ska_array2d_reset_default(SkaArray2D* array2d, void* defaultValue);
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seika",
"version": "0.0.41",
"version": "0.0.42",
"dependencies": [
{
"name": "sdl2",
Expand Down

0 comments on commit d1622f4

Please sign in to comment.