raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::Color Class Reference

Color type, RGBA (32bit) More...

Public Member Functions

 Color ()
 Black.
 
 Color (::Vector3 hsv)
 Returns a Color from HSV values.
 
 Color (::Vector4 normalized)
 Returns Color from normalized values [0..1].
 
 Color (const ::Color &color)
 
 Color (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
 
 Color (unsigned int hexValue)
 Get Color structure from hexadecimal value.
 
 Color (void *srcPtr, int format)
 
Color Alpha (float alpha) const
 Returns color with alpha applied, alpha goes from 0.0f to 1.0f.
 
Color AlphaBlend (::Color dst, ::Color tint) const
 Returns src alpha-blended into dst color with tint.
 
Color Brightness (float factor)
 Get color with brightness correction, brightness factor goes from -1.0f to 1.0f.
 
ColorClearBackground ()
 Set background color (framebuffer clear color)
 
Color Contrast (float contrast)
 Get color with contrast correction, contrast values between -1.0f and 1.0f.
 
void DrawLine (::Vector2 startPos, ::Vector2 endPos) const
 Draw a line using Vector points.
 
void DrawLine (::Vector2 startPos, ::Vector2 endPos, float thick) const
 Draw a line using Vector points, with a given thickness.
 
void DrawLine (int startPosX, int startPosY, int endPosX, int endPosY) const
 Draw a line.
 
void DrawLineBezier (::Vector2 startPos, ::Vector2 endPos, float thick=1.0f) const
 
void DrawLineStrip (::Vector2 *points, int numPoints) const
 
void DrawPixel (::Vector2 pos) const
 Draw a pixel.
 
void DrawPixel (int x, int y) const
 
void DrawRectangle (::Rectangle rec) const
 
void DrawRectangle (::Rectangle rec, ::Vector2 origin, float rotation) const
 
void DrawRectangle (::Vector2 position, ::Vector2 size) const
 
void DrawRectangle (int posX, int posY, int width, int height) const
 
void DrawRectangleLines (::Rectangle rec, float lineThick) const
 
void DrawRectangleLines (int posX, int posY, int width, int height) const
 
void DrawText (const ::Font &font, const char *text, ::Vector2 position, ::Vector2 origin, float rotation, float fontSize, float spacing) const
 
void DrawText (const ::Font &font, const char *text, ::Vector2 position, float fontSize, float spacing) const
 
void DrawText (const ::Font &font, const std::string &text, ::Vector2 position, ::Vector2 origin, float rotation, float fontSize, float spacing) const
 
void DrawText (const ::Font &font, const std::string &text, ::Vector2 position, float fontSize, float spacing) const
 
void DrawText (const char *text, int posX=0, int posY=0, int fontSize=10.0f) const
 
void DrawText (const std::string &text, int posX=0, int posY=0, int fontSize=10.0f) const
 
Color Fade (float alpha) const
 Returns color with alpha applied, alpha goes from 0.0f to 1.0f.
 
unsigned char GetA () const
 Retrieves the a value for the object. More...
 
unsigned char GetB () const
 Retrieves the b value for the object. More...
 
unsigned char GetG () const
 Retrieves the g value for the object. More...
 
unsigned char GetR () const
 Retrieves the r value for the object. More...
 
bool IsEqual (::Color color)
 
Color Lerp (::Color color2, float factor)
 
Vector4 Normalize () const
 Returns Color normalized as float [0..1].
 
 operator int () const
 Returns hexadecimal value for a Color.
 
 operator std::string () const
 
bool operator!= (const ::Color &other) const
 
Coloroperator= (const ::Color &color)
 
bool operator== (const ::Color &other) const
 
void SetA (unsigned char value)
 Sets the a value for the object. More...
 
void SetB (unsigned char value)
 Sets the b value for the object. More...
 
void SetG (unsigned char value)
 Sets the g value for the object. More...
 
void SetR (unsigned char value)
 Sets the r value for the object. More...
 
Color Tint (::Color tint)
 Get color multiplied with another color.
 
Vector3 ToHSV () const
 Returns HSV values for a Color.
 
int ToInt () const
 Returns hexadecimal value for a Color.
 
std::string ToString () const
 

Static Public Member Functions

static Color Beige ()
 
static Color Black ()
 
static Color Blank ()
 
static Color Blue ()
 
static Color Brown ()
 
static Color DarkBlue ()
 
static Color DarkBrown ()
 
static Color DarkGray ()
 
static Color DarkGreen ()
 
static Color DarkPurple ()
 
::Color FromHSV (float hue, float saturation, float value)
 Returns a Color from HSV values.
 
static Color Gold ()
 
static Color Gray ()
 
static Color Green ()
 
static Color LightGray ()
 
static Color Lime ()
 
static Color Magenta ()
 
static Color Maroon ()
 
static Color Orange ()
 
static Color Pink ()
 
static Color Purple ()
 
static Color RayWhite ()
 
static Color Red ()
 
static Color SkyBlue ()
 
static Color Violet ()
 
static Color White ()
 
static Color Yellow ()
 

Protected Member Functions

void set (const ::Color &color)
 

Detailed Description

Color type, RGBA (32bit)

Definition at line 14 of file Color.hpp.

Member Function Documentation

◆ GetA()

unsigned char raylib::Color::GetA ( ) const
inline

Retrieves the a value for the object.

Returns
The a value of the object.

Definition at line 80 of file Color.hpp.

◆ GetB()

unsigned char raylib::Color::GetB ( ) const
inline

Retrieves the b value for the object.

Returns
The b value of the object.

Definition at line 79 of file Color.hpp.

◆ GetG()

unsigned char raylib::Color::GetG ( ) const
inline

Retrieves the g value for the object.

Returns
The g value of the object.

Definition at line 78 of file Color.hpp.

◆ GetR()

unsigned char raylib::Color::GetR ( ) const
inline

Retrieves the r value for the object.

Returns
The r value of the object.

Definition at line 77 of file Color.hpp.

◆ SetA()

void raylib::Color::SetA ( unsigned char  value)
inline

Sets the a value for the object.

Parameters
valueThe value of which to set a to.

Definition at line 80 of file Color.hpp.

◆ SetB()

void raylib::Color::SetB ( unsigned char  value)
inline

Sets the b value for the object.

Parameters
valueThe value of which to set b to.

Definition at line 79 of file Color.hpp.

◆ SetG()

void raylib::Color::SetG ( unsigned char  value)
inline

Sets the g value for the object.

Parameters
valueThe value of which to set g to.

Definition at line 78 of file Color.hpp.

◆ SetR()

void raylib::Color::SetR ( unsigned char  value)
inline

Sets the r value for the object.

Parameters
valueThe value of which to set r to.

Definition at line 77 of file Color.hpp.