![]() |
Blamite Game Engine - blam!
00285.12.18.20.1411.blamite
The core library for the Blamite Game Engine.
|
Structure representing a color. More...
#include <globals.h>
Public Member Functions | |
BlamColor () | |
BlamColor (short _r, short _g, short _b) | |
BlamColor (short _r, short _g, short _b, short _a) | |
std::string | ToString () |
Converts the color value to a string. More... | |
float | GetRedAsFloat () |
Gets the color's red value as a float, between 0 and 1. More... | |
float | GetGreenAsFloat () |
Gets the color's red value as a float, between 0 and 1. More... | |
float | GetBlueAsFloat () |
Gets the color's red value as a float, between 0 and 1. More... | |
float | GetAlphaAsFloat () |
Gets the color's red value as a float, between 0 and 1. More... | |
int | GetColorAsInt () |
Gets the color's value as an integer. More... | |
std::string | ToString (std::string format) |
Converts the color value to a string in the specified format. More... | |
std::string | ToStringForCSS () |
Converts the color to a string that can be used with CSS. More... | |
bool | FromString (std::string string) |
Attempts to set color information from a string. More... | |
Public Attributes | |
unsigned char | r = 255 |
The Red value of the color. More... | |
unsigned char | g = 255 |
The Green value of the color. More... | |
unsigned char | b = 255 |
The Blue value of the color. More... | |
unsigned char | a = 255 |
The Alpha value of the color. More... | |
Structure representing a color.
Used for a variety of purposes in the engine.
Color values range from 0 to 255. To convert to a float-based color, use #Blam::Colors::D2DColorFromBlamColor.
|
inline |
|
inline |
|
inline |
|
inline |
Attempts to set color information from a string.
String should be in either r,g,b
or r,g,b,a
format - the same format as is returned when using BlamColor::ToString();
string | - The string to try to convert to a color. |
true
if the color was converted successfully, false
if the conversion failed.
|
inline |
Gets the color's red value as a float, between 0 and 1.
|
inline |
Gets the color's red value as a float, between 0 and 1.
|
inline |
Gets the color's value as an integer.
This function will convert this color's value as an integer, in 0xAABBGGRR
format. Each color is written in its hexadecimal format (ranging from 0x0 to 0xFF).
|
inline |
Gets the color's red value as a float, between 0 and 1.
|
inline |
Gets the color's red value as a float, between 0 and 1.
|
inline |
Converts the color value to a string.
r,g,b,a
format.
|
inline |
Converts the color value to a string in the specified format.
The provided string can contain the following keys which will be replaced with the color values:
{r}
- Red{g}
- Green{b}
- Blue{a}
- AlphaAdditionally, you can have a float representation of the value (instead of 0-255) by adding >f
inside a color placeholder. Example: {r}
of 255 would be 1.0 with {r>f}
.
format | - The string containing any color placeholders to be replaced. |
|
inline |
Converts the color to a string that can be used with CSS.
rgba(r,g,b,a)
unsigned char BlamColor::a = 255 |
The Alpha value of the color.
unsigned char BlamColor::b = 255 |
The Blue value of the color.
unsigned char BlamColor::g = 255 |
The Green value of the color.
unsigned char BlamColor::r = 255 |
The Red value of the color.