summaryrefslogtreecommitdiff
path: root/include/JSystem/JUtility/TColor.h
blob: e8bf44d45fe287308cddfa0cc6de4792c0339a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef TCOLOR_H
#define TCOLOR_H

#include "dolphin/gx/GXStruct.h"

namespace JUtility {
    
/**
* @ingroup jsystem-jutility
*
*/
struct TColor : public GXColor {
    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); }

    // TColor(const TColor& other) { set(other.toUInt32()); }

    operator u32() const { return toUInt32(); }
    u32 toUInt32() const { return *(u32*)&r; }

    void set(u8 cR, u8 cG, u8 cB, u8 cA) {
        r = cR;
        g = cG;
        b = cB;
        a = cA;
    }

    void set(u32 u32Color) { *(u32*)&r = u32Color; }
    void set(GXColor gxColor) { *(GXColor*)&r = gxColor; }
};
}  // namespace JUtility

#endif