From 4b6ae783ce2c9f08d21d2a2969826412cc587de2 Mon Sep 17 00:00:00 2001 From: realtradam Date: Tue, 25 Apr 2023 20:28:59 -0400 Subject: finish switching to c99 --- CMakeLists.txt | 2 +- include/rodeo/log_t.h | 12 ++++++++---- include/rodeo_types.h | 9 ++++++--- src/rodeo_math.c | 16 ++++++++-------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8865d6..a19af39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ add_library(${PROJECT_NAME} "src/input/rodeo_input.c" ) -set_property(TARGET RodeoKit PROPERTY C_STANDARD 11) +set_property(TARGET RodeoKit PROPERTY C_STANDARD 99) set_property(TARGET RodeoKit PROPERTY CXX_STANDARD 11) # pull all git submodules recursively diff --git a/include/rodeo/log_t.h b/include/rodeo/log_t.h index 844601a..89accc3 100644 --- a/include/rodeo/log_t.h +++ b/include/rodeo/log_t.h @@ -19,10 +19,12 @@ void typedef union { - struct { + struct + { float x; float y; - }; + } + position; float array[2]; } rodeo_vector2_t; @@ -30,11 +32,13 @@ rodeo_vector2_t; typedef union { - struct { + struct + { float x; float y; float z; - }; + } + position; float array[3]; } rodeo_vector3_t; diff --git a/include/rodeo_types.h b/include/rodeo_types.h index bc92fb4..f3c81fa 100644 --- a/include/rodeo_types.h +++ b/include/rodeo_types.h @@ -14,12 +14,14 @@ typedef irodeo_texture_internal_t *rodeo_texture_internal_p; typedef union { - struct { + struct + { float red; float green; float blue; float alpha; - }; + } + colors; float array[4]; } rodeo_color_RGBAFloat_t; @@ -33,7 +35,8 @@ union uint8_t green; uint8_t blue; uint8_t alpha; - }; + } + colors; uint32_t rgba; uint8_t array[4]; } diff --git a/src/rodeo_math.c b/src/rodeo_math.c index 0e421ed..a6f5042 100644 --- a/src/rodeo_math.c +++ b/src/rodeo_math.c @@ -20,10 +20,10 @@ rodeo_color_RGBA8_t rodeo_color_RGBAFloat_to_RGBA8(const rodeo_color_RGBAFloat_t color) { return (rodeo_color_RGBA8_t){ - .red = (uint8_t)((color.red * (float)UINT8_MAX) + 0.5), - .green = (uint8_t)((color.green * (float)UINT8_MAX) + 0.5), - .blue = (uint8_t)((color.blue * (float)UINT8_MAX) + 0.5), - .alpha = (uint8_t)((color.alpha * (float)UINT8_MAX) + 0.5), + .colors.red = (uint8_t)((color.colors.red * (float)UINT8_MAX) + 0.5), + .colors.green = (uint8_t)((color.colors.green * (float)UINT8_MAX) + 0.5), + .colors.blue = (uint8_t)((color.colors.blue * (float)UINT8_MAX) + 0.5), + .colors.alpha = (uint8_t)((color.colors.alpha * (float)UINT8_MAX) + 0.5), }; } @@ -31,10 +31,10 @@ rodeo_color_RGBAFloat_t rodeo_color_RGBA8_to_RGBAFloat(const rodeo_color_RGBA8_t color) { return (rodeo_color_RGBAFloat_t){ - .red = (float)color.red / 255.0f, - .green = (float)color.green / 255.0f, - .blue = (float)color.blue / 255.0f, - .alpha = (float)color.alpha / 255.0f, + .colors.red = (float)color.colors.red / 255.0f, + .colors.green = (float)color.colors.green / 255.0f, + .colors.blue = (float)color.colors.blue / 255.0f, + .colors.alpha = (float)color.colors.alpha / 255.0f, }; } -- cgit v1.2.3