mirror of https://github.com/PrimeDecomp/prime.git
Use union in CTextColor
This commit is contained in:
parent
ab1f7c19a2
commit
b49d6096c7
|
@ -3,15 +3,38 @@
|
|||
|
||||
#include <types.h>
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#pragma cpp_extensions on
|
||||
#endif
|
||||
|
||||
class CTextColor {
|
||||
public:
|
||||
CTextColor(uchar r, uchar g, uchar b, uchar a) : mR(r), mG(g), mB(b), mA(a) {}
|
||||
|
||||
CTextColor(const CTextColor& other) : mR(other.mR), mG(other.mG), mB(other.mB), mA(other.mA) {}
|
||||
|
||||
const CTextColor& operator=(const CTextColor& other) {
|
||||
mR = other.mR;
|
||||
mG = other.mG;
|
||||
mB = other.mB;
|
||||
mA = other.mA;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
uchar mR;
|
||||
uchar mG;
|
||||
uchar mB;
|
||||
uchar mA;
|
||||
union {
|
||||
struct {
|
||||
uchar mR;
|
||||
uchar mG;
|
||||
uchar mB;
|
||||
uchar mA;
|
||||
};
|
||||
uint mRgba;
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#pragma cpp_extensions off
|
||||
#endif
|
||||
|
||||
#endif // _CTEXTCOLOR
|
||||
|
|
Loading…
Reference in New Issue