dungeon/src/Color.h
Adrian Hedqvist ec131d8bda Too much stuff
* Implemented lua using kaguya, only for config files for now
* Moved color struct to its own header
* statically link glew instead of including the source in the project
* Other stuff that I don't remember
2017-10-18 12:25:25 +02:00

44 lines
796 B
C

#ifndef DUNGEON_COLOR_H
#define DUNGEON_COLOR_H
struct Color {
float r = 1;
float g = 1;
float b = 1;
float a = 1;
Color() {}
Color(float r, float g, float b, float a) {
this->r = r;
this->g = g;
this->b = b;
this->a = a;
}
Color operator*(float n) {
return Color(r*n, g*n, b*n, a);
}
void operator*=(float n) {
r *= n;
g *= n;
b *= n;
}
Color operator/(float n) { return (*this) * (1.f / n); }
Color operator*(Color &col) {
return Color(r*col.r, g*col.g, b*col.b, a*col.a);
}
Color operator+(Color &col) {
return Color(r+col.r, g+col.g, b+col.b, a+col.a);
}
Color operator-(Color &col) {
return Color(r - col.r, g - col.g, b - col.b, a - col.a);
}
};
#endif