1 #ifndef RAYLIB_CPP_INCLUDE_COLOR_HPP_
2 #define RAYLIB_CPP_INCLUDE_COLOR_HPP_
6 #include "./raylib.hpp"
7 #include "./Vector4.hpp"
8 #include "./raylib-cpp-utils.hpp"
16 Color(const ::Color& color) {
24 unsigned char alpha = 255) :
::Color{red, green, blue, alpha} {};
35 set(::ColorFromHSV(hsv.x, hsv.y, hsv.z));
41 static ::Color
FromHSV(
float hue,
float saturation,
float value) {
42 return ::ColorFromHSV(hue, saturation, value);
49 set(::GetColor(hexValue));
56 set(::ColorFromNormalized(normalized));
63 return ::ColorToInt(*
this);
69 operator int()
const {
70 return ::ColorToInt(*
this);
77 return ::Fade(*
this, alpha);
84 return ::ColorNormalize(*
this);
91 return ::ColorToHSV(*
this);
94 GETTERSETTER(
unsigned char, R, r)
95 GETTERSETTER(
unsigned char, G, g)
96 GETTERSETTER(
unsigned char, B, b)
97 GETTERSETTER(
unsigned char, A, a)
112 inline Color& DrawPixel(
int x,
int y) {
113 ::DrawPixel(x, y, *
this);
121 ::DrawPixelV(pos, *
this);
128 inline Color&
DrawLine(
int startPosX,
int startPosY,
int endPosX,
int endPosY) {
129 ::DrawLine(startPosX, startPosY, endPosX, endPosY, *
this);
134 ::DrawLineV(startPos, endPos, *
this);
138 inline Color&
DrawLine(::Vector2 startPos, ::Vector2 endPos,
float thick) {
139 ::DrawLineEx(startPos, endPos, thick, *
this);
143 inline Color& DrawLineBezier(::Vector2 startPos, ::Vector2 endPos,
float thick) {
144 ::DrawLineBezier(startPos, endPos, thick, *
this);
148 inline Color& DrawLineStrip(::Vector2 *points,
int numPoints) {
149 ::DrawLineStrip(points, numPoints, *
this);
153 inline Color& DrawText(
const std::string& text,
int posX,
int posY,
int fontSize) {
154 ::DrawText(text.c_str(), posX, posY, fontSize, *
this);
158 inline Color& DrawText(const ::Font& font,
const std::string& text, ::Vector2 position,
159 float fontSize,
float spacing) {
160 ::DrawTextEx(font, text.c_str(), position, fontSize, spacing, *
this);
164 inline Color& DrawText(
166 const std::string& text,
172 ::DrawTextPro(font, text.c_str(), position, origin, rotation, fontSize, spacing, *
this);
176 inline Color& DrawRectangle(
int posX,
int posY,
int width,
int height) {
177 ::DrawRectangle(posX, posY, width, height, *
this);
181 inline Color& DrawRectangle(::Vector2 position, ::Vector2 size) {
182 ::DrawRectangleV(position, size, *
this);
186 inline Color& DrawRectangle(::Rectangle rec) {
187 ::DrawRectangleRec(rec, *
this);
191 inline Color& DrawRectangle(::Rectangle rec, ::Vector2 origin,
float rotation) {
192 ::DrawRectanglePro(rec, origin, rotation, *
this);
196 inline Color& DrawRectangleLines(
int posX,
int posY,
int width,
int height) {
197 ::DrawRectangleLines(posX, posY, width, height, *
this);
201 inline Color& DrawRectangleLines(::Rectangle rec,
float lineThick) {
202 ::DrawRectangleLinesEx(rec, lineThick, *
this);
210 return ::ColorAlpha(*
this, alpha);
217 return ::ColorAlphaBlend(dst, *
this, tint);
220 inline static Color LightGray() {
return LIGHTGRAY; }
221 inline static Color Gray() {
return GRAY; }
222 inline static Color DarkGray() {
return DARKGRAY; }
223 inline static Color Yellow() {
return YELLOW; }
224 inline static Color Gold() {
return GOLD; }
225 inline static Color Orange() {
return ORANGE; }
226 inline static Color Pink() {
return PINK; }
227 inline static Color Red() {
return RED; }
228 inline static Color Maroon() {
return MAROON; }
229 inline static Color Green() {
return GREEN; }
230 inline static Color Lime() {
return LIME; }
231 inline static Color DarkGreen() {
return DARKGREEN; }
232 inline static Color SkyBlue() {
return SKYBLUE; }
233 inline static Color Blue() {
return BLUE; }
234 inline static Color DarkBlue() {
return DARKBLUE; }
235 inline static Color Purple() {
return PURPLE; }
236 inline static Color Violet() {
return VIOLET; }
237 inline static Color DarkPurple() {
return DARKPURPLE; }
238 inline static Color Beige() {
return BEIGE; }
239 inline static Color Brown() {
return BROWN; }
240 inline static Color DarkBrown() {
return DARKBROWN; }
241 inline static Color White() {
return WHITE; }
242 inline static Color Black() {
return BLACK; }
243 inline static Color Blank() {
return BLANK; }
244 inline static Color Magenta() {
return MAGENTA; }
245 inline static Color RayWhite() {
return RAYWHITE; }
248 inline void set(const ::Color& color) {
258 #endif // RAYLIB_CPP_INCLUDE_COLOR_HPP_