Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RGBA

Add this in your code:

#include <engine/graphics/color/color.h>

Description

This class stores information about a color.

Constructors


RGBA

Parameters:

  • r: Red level [0.0f;1.0f]
  • g: Green level [0.0f;1.0f]
  • b: Blue level [0.0f;1.0f]
  • a: Alpha level [0.0f;1.0f]
constexpr RGBA(float r, float g, float b, float a)

Code sample:

RGBA myRGBA = RGBA(1.0f, 0.6f, 0.3f, 0.1f);

Public methods


ToVector4

Get RGBA as a Vector4 [0.0f;1.0f] x = red, y = green, z = blue, w = alpha.

Vector4 ToVector4() const

Code sample:

RGBA myRGBA = RGBA(1.0f, 0.6f, 0.3f, 0.1f);
Vector4 rgbaAsVector4 = myRGBA.ToVector4();

Variables


NameTypeDescription
rfloatRed information [0.0f;1.0f]
gfloatGreen information [0.0f;1.0f]
bfloatBlue information [0.0f;1.0f]
afloatAlpha information [0.0f;1.0f]