2021-09-24 17:51:55 +02:00
|
|
|
#ifndef TCOLOR_H
|
|
|
|
|
#define TCOLOR_H
|
|
|
|
|
|
2025-02-10 11:20:42 -08:00
|
|
|
#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); }
|
2022-06-29 13:19:09 -07:00
|
|
|
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
|
|
|
|
|
|
2025-02-10 11:20:42 -08:00
|
|
|
#endif
|