summaryrefslogtreecommitdiff
path: root/src/gui/palette.h
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-04-15 19:42:07 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-15 19:43:35 +0200
commitef13037435c671b76c75c3ecefbad83dbdc578f2 (patch)
tree18f75b4e1a72d0453e9d9ae621ced87066123d7c /src/gui/palette.h
parentfc4a12470adde2502f37f22b86f58560e416f3e4 (diff)
downloadmana-ef13037435c671b76c75c3ecefbad83dbdc578f2.tar.gz
mana-ef13037435c671b76c75c3ecefbad83dbdc578f2.tar.bz2
mana-ef13037435c671b76c75c3ecefbad83dbdc578f2.tar.xz
mana-ef13037435c671b76c75c3ecefbad83dbdc578f2.zip
Exposed delay values to the user, but made it so that the delay is color
based, instead of global, so that the user can specify different delays for different types of actions. Signed-off-by: Ira Rice <irarice@gmail.com> Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/gui/palette.h')
-rw-r--r--src/gui/palette.h31
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