diff --git a/include/Kyoto/Graphics/CColor.hpp b/include/Kyoto/Graphics/CColor.hpp new file mode 100644 index 00000000..66b0ae0c --- /dev/null +++ b/include/Kyoto/Graphics/CColor.hpp @@ -0,0 +1,41 @@ +#ifndef __CCOLOR_HPP__ +#define __CCOLOR_HPP__ + +#include "types.h" + +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) {} + + + static const CColor& Black(); + static const CColor& White(); + static const CColor& Grey(); + static const CColor& Red(); + static const CColor& Blue(); + static const CColor& Yellow(); + static const CColor& Orange(); +private: + union { + struct { + u8 mR; + u8 mG; + u8 mB; + u8 mA; + }; + 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; +}; + +#endif // __CCOLOR_HPP__ diff --git a/include/Kyoto/Math/CColor.hpp b/include/Kyoto/Math/CColor.hpp deleted file mode 100644 index 5e472ff8..00000000 --- a/include/Kyoto/Math/CColor.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __CCOLOR_HPP__ -#define __CCOLOR_HPP__ - -#include "types.h" - -class CColor { -public: - u8 r; - u8 g; - u8 b; - u8 a; -}; - -#endif // __CCOLOR_HPP__ diff --git a/obj_files.mk b/obj_files.mk index 795f3f1b..8c4daf44 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -581,7 +581,7 @@ KYOTO :=\ $(BUILD_DIR)/asm/Kyoto/Animation/CCharAnimTime.o\ $(BUILD_DIR)/asm/Kyoto/Animation/CSegIdList.o\ $(BUILD_DIR)/asm/Kyoto/CFinalInput.o\ - $(BUILD_DIR)/asm/Kyoto/Graphics/CColor.o\ + $(BUILD_DIR)/src/Kyoto/Graphics/CColor.o\ $(BUILD_DIR)/asm/Kyoto/Audio/DolphinCAudioGroupSet.o\ $(BUILD_DIR)/asm/Kyoto/Audio/DolphinCAudioSys.o\ $(BUILD_DIR)/asm/Kyoto/DolphinCMemoryCardSys.o\ diff --git a/src/Kyoto/Graphics/CColor.cpp b/src/Kyoto/Graphics/CColor.cpp new file mode 100644 index 00000000..286e26aa --- /dev/null +++ b/src/Kyoto/Graphics/CColor.cpp @@ -0,0 +1,19 @@ +#include "Kyoto/Graphics/CColor.hpp" + +const CColor CColor::sBlackColor (0x000000FF); +const CColor CColor::sWhiteColor (0xFFFFFFFF); +const CColor CColor::sGreyColor (0x808080FF); +const CColor CColor::sRedColor (0xFF0000FF); +const CColor CColor::sGreenColor (0x00FF00FF); +const CColor CColor::sBlueColor (0x0000FFFF); +const CColor CColor::sYellowColor(0xFFFF00FF); +const CColor CColor::sPurpleColor(0xA000FFFF); +const CColor CColor::sOrangeColor(0xFF7000FF); + +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::Blue() { return sBlueColor; } +const CColor& CColor::Yellow() { return sYellowColor; } +const CColor& CColor::Orange() { return sOrangeColor; }