JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Color Class Reference

Object representing a RGB color. More...

#include <jngl/Color.hpp>

Public Member Functions

 Color (unsigned char red, unsigned char green, unsigned char blue)
 
unsigned char getRed () const
 0...255
 
void setRed (unsigned char)
 0...255
 
unsigned char getGreen () const
 0...255
 
void setGreen (unsigned char)
 0...255
 
unsigned char getBlue () const
 0...255
 
void setBlue (unsigned char)
 0...255
 

Detailed Description

Object representing a RGB color.

You can use the custom literal operator to create a jngl::Color from HTML color codes. For example #68da4f becomes:

jngl::Color color = 0x68da4f_rgb;
Object representing a RGB color.
Definition Color.hpp:28

You can use this to quickly pass a HTML code to jngl::setColor. The following lines are equivalent:

jngl::setColor(0x68da4f_rgb);
jngl::setColor(jngl::Color(0x68, 0xda, 0x4f));
jngl::setColor(jngl::Color(104, 218, 79));
void setColor(Rgb)
Sets the color which should be used to draw primitives.

Definition at line 28 of file Color.hpp.

Constructor & Destructor Documentation

◆ Color()

Color ( unsigned char red,
unsigned char green,
unsigned char blue )
Parameters
red0...255
green0...255
blue0...255

The documentation for this class was generated from the following file: