Mana
|
Class controlling the game's color palette. More...
#include <userpalette.h>
Public Types | |
enum | { BEING , PC , SELF , GM , NPC , MONSTER , PARTY , GUILD , PARTICLE , EXP_INFO , PICKUP_INFO , HIT_PLAYER_MONSTER , HIT_MONSTER_PLAYER , HIT_CRITICAL , HIT_LOCAL_PLAYER_MONSTER , HIT_LOCAL_PLAYER_CRITICAL , HIT_LOCAL_PLAYER_MISS , MISS , USER_COLOR_LAST } |
List of all colors that are configurable. More... | |
![]() | |
enum | GradientType { STATIC , PULSE , SPECTRUM , RAINBOW } |
Colors can be static or can alter over time. More... | |
Public Member Functions | |
UserPalette () | |
~UserPalette () override | |
const gcn::Color & | getCommittedColor (int type) |
Gets the committed color associated with the specified type. | |
const gcn::Color & | getTestColor (int type) |
Gets the test color associated with the specified type. | |
void | setTestColor (int type, const gcn::Color &color) |
Sets the test color associated with the specified type. | |
void | setColor (int type, int r, int g, int b) |
Sets the color for the specified type. | |
void | setGradient (int type, Palette::GradientType grad) |
Sets the gradient type for the specified color. | |
void | setGradientDelay (int type, int delay) |
Sets the gradient delay for the specified color. | |
int | getNumberOfElements () override |
Returns the number of colors known. | |
std::string | getElementAt (int i) override |
Returns the name of the ith color. | |
void | commit () |
Commit the colors. | |
void | rollback () |
Rollback the colors. | |
int | getColorTypeAt (int i) |
Gets the ColorType used by the color for the element at index i in the current color model. | |
![]() | |
Palette (int size) | |
Palette (const Palette &)=delete | |
Palette (Palette &&) | |
~Palette () | |
Palette & | operator= (const Palette &)=delete |
Palette & | operator= (Palette &&) |
void | setColor (int type, const gcn::Color &color, const std::optional< gcn::Color > &outlineColor, GradientType grad, int delay) |
const gcn::Color & | getColor (int type) const |
Gets the color associated with the type. | |
const std::optional< gcn::Color > & | getOutlineColor (int type) const |
Gets the optional outline color associated with the type. | |
GradientType | getGradientType (int type) const |
Gets the GradientType associated with the specified type. | |
int | getGradientDelay (int type) const |
Gets the gradient delay for the specified type. | |
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 (int type, unsigned int rgb, GradientType grad, const std::string &text, int delay=GRADIENT_DELAY) |
Initialise color. | |
Additional Inherited Members | |
![]() | |
static void | advanceGradients () |
Updates all colors, that are non-static. | |
![]() | |
using | Palettes = std::set< Palette * > |
![]() | |
void | advanceGradient (int advance) |
![]() | |
std::vector< ColorElem > | mColors |
Vector containing the colors. | |
std::vector< ColorElem * > | mGradVector |
![]() | |
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. | |
static Timer | mRainbowTimer |
Timer used when updating gradient-type colors. | |
static Palettes | mInstances |
Class controlling the game's color palette.
Definition at line 32 of file userpalette.h.
anonymous enum |
List of all colors that are configurable.
Definition at line 36 of file userpalette.h.
UserPalette::UserPalette | ( | ) |
Definition at line 51 of file userpalette.cpp.
|
override |
Definition at line 86 of file userpalette.cpp.
|
private |
Initialise color.
rgb | default color if not found in config |
text | identifier of color |
Definition at line 193 of file userpalette.cpp.
|
inline |
Commit the colors.
Definition at line 139 of file userpalette.h.
|
private |
Commit the colors.
Commit the non-static color values, if commitNonStatic is true. Only needed in the constructor.
Definition at line 146 of file userpalette.cpp.
int UserPalette::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 183 of file userpalette.cpp.
|
inline |
Gets the committed color associated with the specified type.
type | the color type requested |
Definition at line 69 of file userpalette.h.
|
override |
Returns the name of the ith color.
i | index of color interested in |
Definition at line 137 of file userpalette.cpp.
|
inlineoverride |
Returns the number of colors known.
Definition at line 125 of file userpalette.h.
|
inline |
Gets the test color associated with the specified type.
type | the color type requested |
Definition at line 81 of file userpalette.h.
void UserPalette::rollback | ( | ) |
Rollback the colors.
Definition at line 163 of file userpalette.cpp.
void UserPalette::setColor | ( | int | 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 105 of file userpalette.cpp.
|
private |
Define a color replacement.
i | the index of the color to replace |
r | red component |
g | green component |
b | blue component |
void UserPalette::setGradient | ( | int | type, |
Palette::GradientType | grad | ||
) |
Sets the gradient type for the specified color.
grad | gradient type to set |
Definition at line 112 of file userpalette.cpp.
|
inline |
Sets the gradient delay for the specified color.
Definition at line 117 of file userpalette.h.
|
inline |
Sets the test color associated with the specified type.
type | the color type requested |
color | the color that should be tested |
Definition at line 92 of file userpalette.h.