prime/include/Kyoto/Text/CTextColor.hpp
Phillip Stephens 6888bad050 Use union in CTextColor
Former-commit-id: b49d6096c70f5495f4465fa6bb314e25b732d8ab
2023-01-11 14:03:38 -08:00

41 lines
680 B
C++

#ifndef _CTEXTCOLOR
#define _CTEXTCOLOR
#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:
union {
struct {
uchar mR;
uchar mG;
uchar mB;
uchar mA;
};
uint mRgba;
};
};
#ifdef __MWERKS__
#pragma cpp_extensions off
#endif
#endif // _CTEXTCOLOR