Skip to content

Commit 961c7c8

Browse files
committed
add setColor shorthands to CCRGBAProtocol
1 parent f1bf2b6 commit 961c7c8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

loader/include/Geode/cocos/include/CCProtocols.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ class CC_DLL CCRGBAProtocol
4747
*/
4848
virtual void setColor(const ccColor3B& color) = 0;
4949

50+
/**
51+
* Changes the color with R,G,B,A bytes
52+
*
53+
* @param color Example: ccc4(255,100,0,255) means R=255, G=100, B=0, A=255
54+
* @note Geode addition
55+
*/
56+
inline void setColor(const ccColor4B& color) {
57+
this->setColor(ccColor3B{color.r, color.g, color.b});
58+
this->setOpacity(color.a);
59+
}
60+
61+
/**
62+
* Changes the color with R,G,B,A floats
63+
*
64+
* @param color Example: ccc4f(1.0, 0.5, 0.25, 1.0) means R=255, G=127, B=63, A=255
65+
* @note Geode addition
66+
*/
67+
inline void setColor(const ccColor4F& color) {
68+
this->setColor(ccc4BFromccc4F(color));
69+
}
70+
5071
/**
5172
* Returns color that is currently used.
5273
*

0 commit comments

Comments
 (0)