// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "dawnlibs.hpp" namespace Dawn { struct ColorU8 { uint8_t r, g, b, a; }; #pragma pack(push, 1) struct Color { float_t r, g, b, a; struct Color operator * (const float_t &x) { return { r * x, g * x, b * x, a * x }; } struct Color operator - (const struct Color &color) { return { r - color.r, g - color.g, b - color.b, a - color.a }; } struct Color operator + (const struct Color &color) { return { r + color.r, g + color.g, b + color.b, a + color.a }; } operator struct ColorU8() const { return { (uint8_t)(r * 255), (uint8_t)(g * 255), (uint8_t)(b * 255), (uint8_t)(a * 255) }; } }; #pragma pack(pop) #define COLOR_WHITE { 1.0f, 1.0f, 1.0f, 1.0f } #define COLOR_RED { 1.0f, 0, 0, 1.0f } #define COLOR_GREEN { 0, 1.0f, 0, 1.0f } #define COLOR_BLUE { 0, 0, 1.0f, 1.0f } #define COLOR_BLACK { 0, 0, 0, 1.0f } #define COLOR_MAGENTA { 1.0f, 0, 1.0f, 1.0f } #define COLOR_DARK_GREY { 0.19607843137254901961f, 0.19607843137254901961f, 0.19607843137254901961f, 1.0f } #define COLOR_LIGHT_GREY { 0.8f, 0.8f, 0.8f, 1.0f } #define COLOR_CORNFLOWER_BLUE { 0.39215686274509803922f, 0.58431372549019607843f, 0.92941176470588235294f, 1.0f } #define COLOR_WHITE_TRANSPARENT { 1.0f, 1.0f, 1.0f, 0 } #define COLOR_BLACK_TRANSPARENT { 0, 0, 0, 0 } #define COLOR_TRANSPARENT COLOR_BLACK_TRANSPARENT }