From bcd6c2e118b42a383dac5bd2dcadeacb2df529a0 Mon Sep 17 00:00:00 2001 From: Chukobyte Date: Sun, 7 Apr 2024 18:16:20 -0400 Subject: [PATCH] Updating macro used to check for valid coords in array2d. --- CMakeLists.txt | 19 +++---------------- seika/data_structures/array2d.c | 6 +++--- seika/version_info.h | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9343b09..d859334 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,8 @@ set(CMAKE_C_STANDARD 11) project(seika C) -if (NOT DEFINED SEIKA_STATIC_LIB) - set(SEIKA_STATIC_LIB "Make seika and dependent libs static" ON) -endif () +option(IS_CI_BUILD "" OFF) +option(SEIKA_STATIC_LIB "Make seika and dependent libs static" OFF) if (CMAKE_C_COMPILER_ID STREQUAL "MSVC") list(APPEND flags "/W3" "/Zc:preprocessor") @@ -38,20 +37,8 @@ endif () target_compile_options(${PROJECT_NAME} PUBLIC ${flags}) -if (NOT SEIKA_STATIC_LIB) - # SDL - file(GLOB SDL3_DLLS "${CMAKE_BINARY_DIR}/_deps/sdl_content-build/*.dll") - install(FILES ${SDL3_DLLS} DESTINATION ${CMAKE_BINARY_DIR}) - # Freetype - file(GLOB FREETYPE_DLLS "${CMAKE_BINARY_DIR}/_deps/freetype_content-build/*.dll") - install(FILES ${FREETYPE_DLLS} DESTINATION ${CMAKE_BINARY_DIR}) -endif () - # Copy directories over that are needed to test -if (NOT DEFINED IS_CI_BUILD) - set(IS_CI_BUILD "false") -endif() -if (IS_CI_BUILD STREQUAL "false") +if (NOT IS_CI_BUILD) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/test diff --git a/seika/data_structures/array2d.c b/seika/data_structures/array2d.c index 6e01666..c4b3cce 100644 --- a/seika/data_structures/array2d.c +++ b/seika/data_structures/array2d.c @@ -5,7 +5,7 @@ #include "seika/memory.h" #include "seika/assert.h" -#define SKA_ARRAY2D_IS_VALID_COORD(ARRAY2D, ROW, COL) (!((int32)ROW >= ARRAY2D->size.w || (int32)COL >= ARRAY2D->size.h)) +#define SKA_ARRAY2D_IS_COORD_INVALID(ARRAY2D, ROW, COL) ((int32)ROW >= ARRAY2D->size.w || (int32)COL >= ARRAY2D->size.h) SkaArray2D* ska_array2d_create(usize rows, usize cols, usize elementSize) { SkaArray2D* newArray = SKA_MEM_ALLOCATE(SkaArray2D); @@ -27,14 +27,14 @@ void ska_array2d_destroy(SkaArray2D* array2d) { } void* ska_array2d_get(SkaArray2D* array2d, usize x, usize y) { - if (!SKA_ARRAY2D_IS_VALID_COORD(array2d, x, y)) { + if (SKA_ARRAY2D_IS_COORD_INVALID(array2d, x, y)) { return NULL; } return (void*)((char*)array2d->data[y] + x * array2d->elementSize); } bool ska_array2d_set(SkaArray2D* array2d, usize x, usize y, void* newValue) { - if (!SKA_ARRAY2D_IS_VALID_COORD(array2d, x, y)) { + if (SKA_ARRAY2D_IS_COORD_INVALID(array2d, x, y)) { return false; } memcpy((void*)((char*)array2d->data[y] + x * array2d->elementSize), newValue, array2d->elementSize); diff --git a/seika/version_info.h b/seika/version_info.h index 665bf70..1291304 100644 --- a/seika/version_info.h +++ b/seika/version_info.h @@ -4,6 +4,6 @@ #define SKA_VERSION_MAJOR 0 #define SKA_VERSION_MINOR 1 -#define SKA_VERSION_PATCH 2 +#define SKA_VERSION_PATCH 3 #define SKA_VERSION (SKA_MACRO_TO_STRING(SKA_VERSION_MAJOR) "." SKA_MACRO_TO_STRING(SKA_VERSION_MINOR) "." SKA_MACRO_TO_STRING(SKA_VERSION_PATCH))