Add c++ compatible struct

This commit is contained in:
Greg Wells
2025-05-14 05:59:06 -04:00
parent 9d0ad3fb83
commit 92ef68938a

View File

@@ -1,6 +1,46 @@
#include "../math/gryphn_vec4.h"
#ifdef GN_UTILS_CPP
struct gnColor {
public:
union {
struct {
int r, g, b;
float a;
};
struct {
int red, green, blue;
float alpha;
};
};
public:
gnColor(int red, int green, int blue, float alpha = 1.0) {
this->red = red;
this->green = green;
this->blue = blue;
this->alpha = alpha;
}
gnColor(int color, float alpha = 1.0) {
this->red = color;
this->green = color;
this->blue = color;
this->alpha = alpha;
}
};
#else
typedef struct gnColor {
int r, g, b;
float a;
union {
struct {
int r, g, b;
float a;
};
struct {
int red, green, blue;
float alpha;
};
};
} gnColor;
#endif