diff --git a/oogabooga/color.c b/oogabooga/color.c new file mode 100644 index 0000000..32616a6 --- /dev/null +++ b/oogabooga/color.c @@ -0,0 +1,11 @@ + +// usage example: hex_to_rgba(0x2a2d3aff); +Vector4 hex_to_rgba(s64 hex) { + u8 r = (hex>>24) & 0x000000FF; + u8 g = (hex>>16) & 0x000000FF; + u8 b = (hex>>8) & 0x000000FF; + u8 a = (hex>>0) & 0x000000FF; + return (Vector4){r/255.0, g/255.0, b/255.0, a/255.0}; +} + +// todo - hsv conversion stuff when it's needed \ No newline at end of file diff --git a/oogabooga/oogabooga.c b/oogabooga/oogabooga.c index 2750017..987f560 100644 --- a/oogabooga/oogabooga.c +++ b/oogabooga/oogabooga.c @@ -134,7 +134,7 @@ void lodepng_free(void* ptr) { #endif #include "random.c" - +#include "color.c" #include "memory.c" #include "input.c"