Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CColor Struct Reference

#include <Color.h>

Inheritance diagram for CColor:

Public Member Functions

 CColor ()
 
 CColor (float cr, float cg, float cb, float ca)
 
 operator bool () const
 Returns whether this has been set to a valid color. More...
 
bool ParseString (const CStr8 &value, int defaultAlpha=255)
 Try to parse Value as a color. More...
 
bool operator== (const CColor &color) const
 
bool operator!= (const CColor &color) const
 
PS::span< const float > AsFloatArray () const
 
SColor4ub AsSColor4ub () const
 

Public Attributes

float r
 
float g
 
float b
 
float a
 

Constructor & Destructor Documentation

◆ CColor() [1/2]

CColor::CColor ( )
inline

◆ CColor() [2/2]

CColor::CColor ( float  cr,
float  cg,
float  cb,
float  ca 
)
inline

Member Function Documentation

◆ AsFloatArray()

PS::span< const float > CColor::AsFloatArray ( ) const
inline

◆ AsSColor4ub()

SColor4ub CColor::AsSColor4ub ( ) const
inline

◆ operator bool()

CColor::operator bool ( ) const
inline

Returns whether this has been set to a valid color.

◆ operator!=()

bool CColor::operator!= ( const CColor color) const
inline

◆ operator==()

bool CColor::operator== ( const CColor color) const

◆ ParseString()

bool CColor::ParseString ( const CStr8 &  value,
int  defaultAlpha = 255 
)

Try to parse Value as a color.

Important: This function does not modify the value if parsing fails.

Returns true on success, false otherwise. Leaves the color unchanged if it failed.

Parameters
valueShould be "r g b" or "r g b a" where each value is an integer in [0,255].
defaultAlphaThe alpha value that is used if the format of Value is "r g b".

Member Data Documentation

◆ a

float CColor::a

◆ b

float CColor::b

◆ g

float CColor::g

◆ r

float CColor::r

The documentation for this struct was generated from the following files: