Files
tp/include/JSystem/JUtility/TColor.h
T

36 lines
754 B
C++
Raw Normal View History

2021-09-24 17:51:55 +02:00
#ifndef TCOLOR_H
#define TCOLOR_H
#include <dolphin/gx.h>
2021-09-24 17:51:55 +02:00
namespace JUtility {
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-jutility
*
*/
2021-09-26 12:11:21 +02:00
struct TColor : public GXColor {
2021-09-24 17:51:55 +02:00
TColor(u8 r, u8 g, u8 b, u8 a) { set(r, g, b, a); }
TColor() { set(0xffffffff); }
TColor(u32 u32Color) { set(u32Color); }
TColor(GXColor color) { set(color); }
2021-09-24 17:51:55 +02:00
2021-09-26 12:11:21 +02:00
// TColor(const TColor& other) { set(other.toUInt32()); }
2021-09-24 17:51:55 +02:00
2021-09-26 12:11:21 +02:00
operator u32() const { return toUInt32(); }
u32 toUInt32() const { return *(u32*)&r; }
2021-09-24 17:51:55 +02:00
void set(u8 cR, u8 cG, u8 cB, u8 cA) {
2021-09-26 12:11:21 +02:00
r = cR;
g = cG;
b = cB;
a = cA;
2021-09-24 17:51:55 +02:00
}
2021-09-26 12:11:21 +02:00
void set(u32 u32Color) { *(u32*)&r = u32Color; }
void set(GXColor gxColor) { *(GXColor*)&r = gxColor; }
2021-09-24 17:51:55 +02:00
};
} // namespace JUtility
#endif