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

Object representing a RGBA color. More...

#include <jngl/Rgba.hpp>

Public Member Functions

 Rgba (float red, float green, float blue, float alpha)
 
 Rgba (float red, float green, float blue, Alpha alpha)
 
 Rgba (Rgb, Alpha)
 
float getRed () const
 0.0f ... 1.0f
 
void setRed (float)
 0.0f ... 1.0f
 
float getGreen () const
 0.0f ... 1.0fu
 
void setGreen (float)
 0.0f ... 1.0f
 
float getBlue () const
 0.0f ... 1.0f
 
void setBlue (float)
 0.0f ... 1.0f
 
float getAlpha () const
 0.0f ... 1.0f
 
void setAlpha (float)
 0.0f ... 1.0f
 
void setAlpha (Alpha)
 
void setRgb (Rgb color)
 Overwrites red, green and blue, but leaves the alpha value untouched.
 
 operator Rgb () const
 Drops the alpha value.
 

Static Public Member Functions

static Rgba u8 (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
 

Detailed Description

Object representing a RGBA color.

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

jngl::Rgba color = 0x68da4fee_rgba;
Object representing a RGBA color.
Definition Rgba.hpp:22

Definition at line 22 of file Rgba.hpp.

Constructor & Destructor Documentation

◆ Rgba()

Rgba ( float red,
float green,
float blue,
float alpha )
Parameters
red0.0f ... 1.0f
green0.0f ... 1.0f
blue0.0f ... 1.0f
alpha0.0f ... 1.0f

Values over 1.0f will result in 1.0f and negatives will result in 0.0f.


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