34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
struct Color {
|
|
private:
|
|
|
|
public:
|
|
float r, g, b, a;
|
|
|
|
constexpr Color(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) {
|
|
|
|
}
|
|
|
|
static constexpr Color FromRGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
|
return Color((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, (float)a / 255.0f);
|
|
}
|
|
|
|
Color() : r(0.0f), g(0.0f), b(0.0f), a(1.0f) {
|
|
|
|
}
|
|
|
|
static constexpr Color AQUA() { return Color(0.0f, 0.0f, 0.0f, 1.0f); }
|
|
static constexpr Color RED() { return Color(1.0f, 0.0f, 0.0f, 1.0f); }
|
|
static constexpr Color GREEN() { return Color(0.0f, 1.0f, 0.0f, 1.0f); }
|
|
static constexpr Color BLUE() { return Color(0.0f, 0.0f, 1.0f, 1.0f); }
|
|
static constexpr Color BLACK() { return Color(0.0f, 0.0f, 0.0f, 1.0f); }
|
|
static constexpr Color WHITE() { return Color(1.0f, 1.0f, 1.0f, 1.0f); }
|
|
static constexpr Color MAGENTA() { return Color(1.0f, 0.0f, 1.0f, 1.0f); }
|
|
static constexpr Color YELLOW() { return Color(1.0f, 1.0f, 0.0f, 1.0f); }
|
|
static constexpr Color ORANGE() { return FromRGBA8(255, 165, 0, 255); }
|
|
static constexpr Color TRANSPARENT() { return Color(0.0f, 0.0f, 0.0f, 0.0f); }
|
|
};
|