![]() |
Blamite Game Engine - blam!
00272.10.26.20.0001.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... | |
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 | |
short | r = 255 |
The Red value of the color. More... | |
short | g = 255 |
The Green value of the color. More... | |
short | b = 255 |
The Blue value of the color. More... | |
short | 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 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)
short BlamColor::a = 255 |
The Alpha value of the color.
short BlamColor::b = 255 |
The Blue value of the color.
short BlamColor::g = 255 |
The Green value of the color.
short BlamColor::r = 255 |
The Red value of the color.