RGBA

From Sven Co-op
Revision as of 19:11, 27 March 2025 by Outerbeast (talk | contribs) (Created page with "The RGBA class is used to define colours with four components: Red, Green, Blue, and Alpha (transparency). This class is particularly useful for customizing visual elements in...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The RGBA class is used to define colours with four components: Red, Green, Blue, and Alpha (transparency). This class is particularly useful for customizing visual elements in the game, such as HUD colors, text, or other graphical features. Each component of the RGBA class is typically represented as an integer value ranging from 0 to 255:

  • Red (r): Controls the intensity of the red color.
  • Green (g): Controls the intensity of the green color.
  • Blue (b): Controls the intensity of the blue color.
  • Alpha (a): Determines the transparency level, where 0 is fully transparent and 255 is fully opaque.

For example, you might use the RGBA class to set a color like this:

RGBA myColor(255, 0, 0, 128); // Semi-transparent red

1 Methods

Declaration Description
void RGBA() Default constructor
void RGBA(uint8 r, uint8 g, uint8 b, uint8 a = 255) Constructor
void RGBA(const Vector& in color, uint8 a = 255) Constructor using an input vector
void RGBA(const RGBA& in other) Copy constructor
RGBA& opAssign(const RGBA& in other) Assignment operator
bool opEquals(const RGBA& in other) const Compare colors
string ToString(const bool withAlpha = true) const Returns a string representation of this RGBA

2 Properties

Declaration Description
uint8 r Red component
uint8 g Green component
uint8 b Blue component
uint8 a Alpha component