Add unused statics, fix CColor constructor

Former-commit-id: e7117197da
This commit is contained in:
Phillip Stephens 2022-08-11 11:35:12 -07:00
parent fe1f119091
commit 6f8c6b28ba
2 changed files with 18 additions and 12 deletions

View File

@ -3,19 +3,23 @@
#include "types.h"
#pragma cpp_extensions on
class CColor {
public:
CColor(u32 col) : mRgba(col) {}
//CColor(float r, float g, float b, float a = 1.f) : mR(r * 255.f), mG(g * 255.f), mB(b * 255.f), mA(a * 255.f) {}
CColor(f32 r, f32 g, f32 b, f32 a = 1.f) : mR(r * 255.f), mG(g * 255.f), mB(b * 255.f), mA(a * 255.f) {}
static const CColor& Black();
static const CColor& White();
static const CColor& Grey();
static const CColor& Red();
static const CColor& Green();
static const CColor& Blue();
static const CColor& Yellow();
static const CColor& Purple();
static const CColor& Orange();
private:
union {
struct {
@ -26,16 +30,16 @@ private:
};
u32 mRgba;
};
static const CColor sBlackColor;
static const CColor sWhiteColor;
static const CColor sGreyColor;
static const CColor sRedColor;
static const CColor sGreenColor;
static const CColor sBlueColor;
static const CColor sYellowColor;
static const CColor sPurpleColor;
static const CColor sOrangeColor;
static const CColor sBlackColor;
static const CColor sWhiteColor;
static const CColor sGreyColor;
static const CColor sRedColor;
static const CColor sGreenColor;
static const CColor sBlueColor;
static const CColor sYellowColor;
static const CColor sPurpleColor;
static const CColor sOrangeColor;
};
#endif // __CCOLOR_HPP__

View File

@ -14,6 +14,8 @@ const CColor& CColor::Black() { return sBlackColor; }
const CColor& CColor::White() { return sWhiteColor; }
const CColor& CColor::Grey() { return sGreyColor; }
const CColor& CColor::Red() { return sRedColor; }
const CColor& CColor::Green() { return sGreenColor; }
const CColor& CColor::Blue() { return sBlueColor; }
const CColor& CColor::Yellow() { return sYellowColor; }
const CColor& CColor::Purple() { return sPurpleColor; }
const CColor& CColor::Orange() { return sOrangeColor; }