113 lines
3.5 KiB
C
113 lines
3.5 KiB
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusk.h"
|
|
|
|
typedef float_t colorchannelf_t;
|
|
typedef uint8_t colorchannelb_t;
|
|
|
|
typedef struct {
|
|
colorchannelf_t r;
|
|
colorchannelf_t g;
|
|
colorchannelf_t b;
|
|
} color3f_t;
|
|
|
|
typedef struct {
|
|
colorchannelf_t r;
|
|
colorchannelf_t g;
|
|
colorchannelf_t b;
|
|
colorchannelf_t a;
|
|
} color4f_t;
|
|
|
|
typedef struct {
|
|
colorchannelb_t r;
|
|
colorchannelb_t g;
|
|
colorchannelb_t b;
|
|
} color3b_t;
|
|
|
|
typedef struct {
|
|
colorchannelb_t r;
|
|
colorchannelb_t g;
|
|
colorchannelb_t b;
|
|
colorchannelb_t a;
|
|
} color4b_t;
|
|
|
|
typedef color4b_t color_t;
|
|
|
|
#define color3f(r, g, b) ((color3f_t){r, g, b})
|
|
#define color4f(r, g, b, a) ((color4f_t){r, g, b, a})
|
|
#define color3b(r, g, b) ((color3b_t){r, g, b})
|
|
#define color4b(r, g, b, a) ((color4b_t){r, g, b, a})
|
|
#define color(r, g, b, a) ((color_t){r, g, b, a})
|
|
|
|
#define color_hex(hex) color( \
|
|
((hex >> 24) & 0xFF), \
|
|
((hex >> 16) & 0xFF), \
|
|
((hex >> 8) & 0xFF), \
|
|
(hex & 0xFF) \
|
|
)
|
|
|
|
#define COLOR_WHITE_3F color3f(1.0f, 1.0f, 1.0f)
|
|
#define COLOR_WHITE_4F color4f(1.0f, 1.0f, 1.0f, 1.0f)
|
|
#define COLOR_WHITE_3B color3b(255, 255, 255)
|
|
#define COLOR_WHITE_4B color4b(255, 255, 255, 255)
|
|
#define COLOR_WHITE color(255, 255, 255, 255)
|
|
|
|
#define COLOR_BLACK_3F color3f(0.0f, 0.0f, 0.0f)
|
|
#define COLOR_BLACK_4F color4f(0.0f, 0.0f, 0.0f, 1.0f)
|
|
#define COLOR_BLACK_3B color3b(0, 0, 0)
|
|
#define COLOR_BLACK_4B color4b(0, 0, 0, 255)
|
|
#define COLOR_BLACK color(0, 0, 0, 255)
|
|
|
|
#define COLOR_RED_3F color3f(1.0f, 0.0f, 0.0f)
|
|
#define COLOR_RED_4F color4f(1.0f, 0.0f, 0.0f, 1.0f)
|
|
#define COLOR_RED_3B color3b(255, 0, 0)
|
|
#define COLOR_RED_4B color4b(255, 0, 0, 255)
|
|
#define COLOR_RED color(255, 0, 0, 255)
|
|
|
|
#define COLOR_GREEN_3F color3f(0.0f, 1.0f, 0.0f)
|
|
#define COLOR_GREEN_4F color4f(0.0f, 1.0f, 0.0f, 1.0f)
|
|
#define COLOR_GREEN_3B color3b(0, 255, 0)
|
|
#define COLOR_GREEN_4B color4b(0, 255, 0, 255)
|
|
#define COLOR_GREEN color(0, 255, 0, 255)
|
|
|
|
#define COLOR_BLUE_3F color3f(0.0f, 0.0f, 1.0f)
|
|
#define COLOR_BLUE_4F color4f(0.0f, 0.0f, 1.0f, 1.0f)
|
|
#define COLOR_BLUE_3B color3b(0, 0, 255)
|
|
#define COLOR_BLUE_4B color4b(0, 0, 255, 255)
|
|
#define COLOR_BLUE color(0, 0, 255, 255)
|
|
|
|
#define COLOR_YELLOW_3F color3f(1.0f, 1.0f, 0.0f)
|
|
#define COLOR_YELLOW_4F color4f(1.0f, 1.0f, 0.0f, 1.0f)
|
|
#define COLOR_YELLOW_3B color3b(255, 255, 0)
|
|
#define COLOR_YELLOW_4B color4b(255, 255, 0, 255)
|
|
#define COLOR_YELLOW color(255, 255, 0, 255)
|
|
|
|
#define COLOR_CYAN_3F color3f(0.0f, 1.0f, 1.0f)
|
|
#define COLOR_CYAN_4F color4f(0.0f, 1.0f, 1.0f, 1.0f)
|
|
#define COLOR_CYAN_3B color3b(0, 255, 255)
|
|
#define COLOR_CYAN_4B color4b(0, 255, 255, 255)
|
|
#define COLOR_CYAN color(0, 255, 255, 255)
|
|
|
|
#define COLOR_MAGENTA_3F color3f(1.0f, 0.0f, 1.0f)
|
|
#define COLOR_MAGENTA_4F color4f(1.0f, 0.0f, 1.0f, 1.0f)
|
|
#define COLOR_MAGENTA_3B color3b(255, 0, 255)
|
|
#define COLOR_MAGENTA_4B color4b(255, 0, 255, 255)
|
|
#define COLOR_MAGENTA color(255, 0, 255, 255)
|
|
|
|
#define COLOR_TRANSPARENT_3F color3f(0.0f, 0.0f, 0.0f)
|
|
#define COLOR_TRANSPARENT_4F color4f(0.0f, 0.0f, 0.0f, 0.0f)
|
|
#define COLOR_TRANSPARENT_3B color3b(0, 0, 0)
|
|
#define COLOR_TRANSPARENT_4B color4b(0, 0, 0, 0)
|
|
#define COLOR_TRANSPARENT color(0, 0, 0, 0)
|
|
|
|
#define COLOR_CORNFLOWER_BLUE_3F color3f(0.39f, 0.58f, 0.93f)
|
|
#define COLOR_CORNFLOWER_BLUE_4F color4f(0.39f, 0.58f, 0.93f, 1.0f)
|
|
#define COLOR_CORNFLOWER_BLUE_3B color3b(100, 149, 237)
|
|
#define COLOR_CORNFLOWER_BLUE_4B color4b(100, 149, 237, 255)
|
|
#define COLOR_CORNFLOWER_BLUE color(100, 149, 237, 255) |