#include <palette.h>
Definition at line 51 of file palette.h.
Public Types | |
| enum | GradientType { STATIC, PULSE, SPECTRUM, RAINBOW } |
| Colors can be static or can alter over time. More... | |
Public Member Functions | |
| TEXTENUM (ColorType, COLOR_TYPE) | |
| Palette () | |
| Constructor. | |
| ~Palette () | |
| Destructor. | |
| const gcn::Color & | getColor (char c, bool &valid) |
| Returns the color associated with a character, if it exists. | |
| const gcn::Color & | getColor (ColorType type, int alpha=255) |
| Gets the color associated with the type. | |
| const gcn::Color & | getCommittedColor (ColorType type) |
| Gets the committed color associated with the specified type. | |
| const gcn::Color & | getTestColor (ColorType type) |
| Gets the test color associated with the specified type. | |
| void | setTestColor (ColorType type, gcn::Color color) |
| Sets the test color associated with the specified type. | |
| GradientType | getGradientType (ColorType type) |
| Gets the GradientType associated with the specified type. | |
| int | getGradientDelay (ColorType type) |
| Gets the gradient delay for the specified type. | |
| char | getColorChar (ColorType type) |
| Get the character used by the specified color. | |
| void | setColor (ColorType type, int r, int g, int b) |
| Sets the color for the specified type. | |
| void | setGradient (ColorType type, GradientType grad) |
| Sets the gradient type for the specified color. | |
| void | setGradientDelay (ColorType type, int delay) |
| Sets the gradient delay for the specified color. | |
| int | getNumberOfElements () |
| Returns the number of colors known. | |
| std::string | getElementAt (int i) |
| Returns the name of the ith color. | |
| ColorType | getColorTypeAt (int i) |
| Gets the ColorType used by the color for the element at index i in the current color model. | |
| void | commit () |
| Commit the colors. | |
| void | rollback () |
| Rollback the colors. | |
| void | advanceGradient () |
| Updates all colors, that are non-static. | |
Private Types | |
| typedef std::vector< ColorElem > | ColVector |
Private Member Functions | |
| void | setColorAt (int i, int r, int g, int b) |
| Define a color replacement. | |
| void | commit (bool commitNonStatic) |
| Commit the colors. | |
| void | addColor (ColorType type, int rgb, GradientType grad, const std::string &text, char c=0, int delay=GRADIENT_DELAY) |
| Initialise color. | |
Static Private Member Functions | |
| static std::string | getConfigName (const std::string &typeName) |
| Prefixes the given string with "Color", lowercases all letters but the first and all following a '_'. | |
Private Attributes | |
| int | mRainbowTime |
| Time tick, that gradient-type colors were updated the last time. | |
| ColVector | mColVector |
| Vector containing the colors. | |
| std::vector< ColorElem * > | mGradVector |
Static Private Attributes | |
| static const gcn::Color | BLACK = gcn::Color(0, 0, 0) |
| Black Color Constant. | |
| static const gcn::Color | RAINBOW_COLORS [] |
| Colors used for the rainbow gradient. | |
| static const int | RAINBOW_COLOR_COUNT = 7 |
| Number of Elemets of RAINBOW_COLORS. | |
Classes | |
| struct | ColorElem |
typedef std::vector<ColorElem> Palette::ColVector [private] |
| Palette::Palette | ( | ) |
| Palette::~Palette | ( | ) |
| Palette::TEXTENUM | ( | ColorType | , | |
| COLOR_TYPE | ||||
| ) |
| const gcn::Color & Palette::getColor | ( | char | c, | |
| bool & | valid | |||
| ) |
Returns the color associated with a character, if it exists.
Returns Palette::BLACK if the character is not found.
| c | character requested | |
| valid | indicate whether character is known |
Definition at line 159 of file palette.cpp.
| const gcn::Color& Palette::getColor | ( | ColorType | type, | |
| int | alpha = 255 | |||
| ) | [inline] |
| const gcn::Color& Palette::getCommittedColor | ( | ColorType | type | ) | [inline] |
| const gcn::Color& Palette::getTestColor | ( | ColorType | type | ) | [inline] |
| void Palette::setTestColor | ( | ColorType | type, | |
| gcn::Color | color | |||
| ) | [inline] |
| GradientType Palette::getGradientType | ( | ColorType | type | ) | [inline] |
| int Palette::getGradientDelay | ( | ColorType | type | ) | [inline] |
| char Palette::getColorChar | ( | ColorType | type | ) | [inline] |
| void Palette::setColor | ( | ColorType | type, | |
| int | r, | |||
| int | g, | |||
| int | b | |||
| ) |
Sets the color for the specified type.
| type | color to be set | |
| r | red component | |
| g | green component | |
| b | blue component |
Definition at line 174 of file palette.cpp.
| void Palette::setGradient | ( | ColorType | type, | |
| GradientType | grad | |||
| ) |
Sets the gradient type for the specified color.
| grad | gradient type to set |
Definition at line 181 of file palette.cpp.
| void Palette::setGradientDelay | ( | ColorType | type, | |
| int | delay | |||
| ) | [inline] |
| int Palette::getNumberOfElements | ( | ) | [inline] |
| std::string Palette::getElementAt | ( | int | i | ) |
Returns the name of the ith color.
| i | index of color interested in |
Definition at line 206 of file palette.cpp.
| Palette::ColorType Palette::getColorTypeAt | ( | int | i | ) |
Gets the ColorType used by the color for the element at index i in the current color model.
| i | the index of the color |
Definition at line 215 of file palette.cpp.
| void Palette::rollback | ( | ) |
| void Palette::advanceGradient | ( | ) |
| void Palette::setColorAt | ( | int | i, | |
| int | r, | |||
| int | g, | |||
| int | b | |||
| ) | [private] |
Define a color replacement.
| i | the index of the color to replace | |
| r | red component | |
| g | green component | |
| b | blue component |
| void Palette::commit | ( | bool | commitNonStatic | ) | [private] |
Commit the colors.
Commit the non-static color values, if commitNonStatic is true. Only needed in the constructor.
Definition at line 224 of file palette.cpp.
| void Palette::addColor | ( | ColorType | type, | |
| int | rgb, | |||
| GradientType | grad, | |||
| const std::string & | text, | |||
| char | c = 0, |
|||
| int | delay = GRADIENT_DELAY | |||
| ) | [private] |
Initialise color.
| c | character that needs initialising | |
| rgb | default color if not found in config | |
| text | identifier of color |
| std::string Palette::getConfigName | ( | const std::string & | typeName | ) | [static, private] |
Prefixes the given string with "Color", lowercases all letters but the first and all following a '_'.
All '_'s will be removed.
E.g.: HIT_PLAYER_MONSTER -> HitPlayerMonster
| typeName | string to transform |
Definition at line 49 of file palette.cpp.
const gcn::Color Palette::BLACK = gcn::Color(0, 0, 0) [static, private] |
const gcn::Color Palette::RAINBOW_COLORS [static, private] |
const int Palette::RAINBOW_COLOR_COUNT = 7 [static, private] |
int Palette::mRainbowTime [private] |
ColVector Palette::mColVector [private] |
std::vector<ColorElem*> Palette::mGradVector [private] |
1.5.5