diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-15 13:10:38 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-15 13:10:38 -0600 |
commit | e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701 (patch) | |
tree | 6c9218f32675f9d401301172869c30488ab08b16 /src/gui/palette.h | |
parent | 56c224050f10d976298cef98607aa3b3e56fcc99 (diff) | |
parent | 3d85a00ff2a33e22ba63d0b7dfc156d8076933e1 (diff) | |
download | mana-client-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.tar.gz mana-client-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.tar.bz2 mana-client-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.tar.xz mana-client-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.zip |
Merge branch 'master' of git@gitorious.org:tmw/mainline
Diffstat (limited to 'src/gui/palette.h')
-rw-r--r-- | src/gui/palette.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/gui/palette.h b/src/gui/palette.h index 6a9fc937..1dec2a60 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -42,6 +42,9 @@ #define DEFENUMNAMES(name,def)\ const std::string Palette::name ## Names[] = { def(ECONFIGSTR,ECONFIGSTR) "" } +// Default Gradient Delay +#define GRADIENT_DELAY 40 + /** * Class controlling the game's color palette. */ @@ -196,6 +199,16 @@ class Palette : public gcn::ListModel } /** + * Gets the gradient delay for the specified type. + * + * @param type the color type of the color + * + * @return the gradient delay of the color with the given index + */ + inline int getGradientDelay(ColorType type) + { return mColVector[type].delay; } + + /** * Get the character used by the specified color. * * @param type the color type of the color @@ -225,6 +238,14 @@ class Palette : public gcn::ListModel void setGradient(ColorType type, GradientType grad); /** + * Sets the gradient delay for the specified color. + * + * @param grad gradient type to set + */ + void setGradientDelay(ColorType type, int delay) + { mColVector[type].delay = delay; } + + /** * Returns the number of colors known. * * @return the number of colors known @@ -275,8 +296,6 @@ class Palette : public gcn::ListModel /** Colors used for the rainbow gradient */ static const gcn::Color RAINBOW_COLORS[]; static const int RAINBOW_COLOR_COUNT; - /** Parameter to control the speed of the gradient */ - static const int GRADIENT_DELAY; /** Time tick, that gradient-type colors were updated the last time. */ int mRainbowTime; @@ -307,9 +326,11 @@ class Palette : public gcn::ListModel GradientType grad; GradientType committedGrad; int gradientIndex; + int delay; + int committedDelay; void set(ColorType type, gcn::Color& color, GradientType grad, - const std::string &text, char c) + const std::string &text, char c, int delay) { ColorElem::type = type; ColorElem::color = color; @@ -317,6 +338,7 @@ class Palette : public gcn::ListModel ColorElem::text = text; ColorElem::ch = c; ColorElem::grad = grad; + ColorElem::delay = delay; ColorElem::gradientIndex = rand(); } @@ -339,7 +361,8 @@ class Palette : public gcn::ListModel * @param text identifier of color */ void addColor(ColorType type, int rgb, GradientType grad, - const std::string &text, char c = 0); + const std::string &text, char c = 0, + int delay = GRADIENT_DELAY); /** * Prefixes the given string with "Color", lowercases all letters but |