From d1622f49f948e271d2067fe3c335d767fda76dc6 Mon Sep 17 00:00:00 2001 From: Chukobyte Date: Mon, 26 Feb 2024 23:53:54 -0500 Subject: [PATCH] Added clear function to 2d array. --- seika/data_structures/ska_array2d.c | 4 ++++ seika/data_structures/ska_array2d.h | 3 +++ vcpkg.json | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/seika/data_structures/ska_array2d.c b/seika/data_structures/ska_array2d.c index 9ffecf3..fa3ccd8 100644 --- a/seika/data_structures/ska_array2d.c +++ b/seika/data_structures/ska_array2d.c @@ -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); } diff --git a/seika/data_structures/ska_array2d.h b/seika/data_structures/ska_array2d.h index b02effc..ae41829 100644 --- a/seika/data_structures/ska_array2d.h +++ b/seika/data_structures/ska_array2d.h @@ -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); diff --git a/vcpkg.json b/vcpkg.json index a9bce2e..3b842b6 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "seika", - "version": "0.0.41", + "version": "0.0.42", "dependencies": [ { "name": "sdl2",