28 #include "utils/timer.h"
41 Color(255, 0, 0, 255),
42 Color(255, 153, 0, 255),
43 Color(255, 255, 0, 255),
44 Color(0, 153, 0, 255),
45 Color(0, 204, 204, 255),
46 Color(51, 0, 153, 255),
47 Color(153, 0, 153, 255)
68 const CharColors::const_iterator it =
mCharColors.find(c);
72 return mColors[(*it).second].color;
82 (*it)->advanceGradient();
93 const int advance = time / 5;
95 for (
size_t i = 0, sz =
mGradVector.size(); i < sz; i++)
101 int delay = elem->delay;
111 elem->gradientIndex = (elem->gradientIndex + advance)
112 % (delay * numOfColors);
114 const int gradIndex = elem->gradientIndex;
115 const int pos = delay != 0 ? (gradIndex % delay) : gradIndex;
118 colIndex = gradIndex / delay;
120 colIndex = gradIndex;
122 Color &color = elem->color;
128 sin(M_PI * colIndex / numOfColors));
130 const Color &col = elem->testColor;
132 color.
r = ((colVal * col.
r) / 255) % (col.
r + 1);
133 color.
g = ((colVal * col.
g) / 255) % (col.
g + 1);
134 color.
b = ((colVal * col.
b) / 255) % (col.
b + 1);
138 if ((colIndex % 2) != 0)
143 (cos(M_PI * pos / delay) + 1) / 2);
148 (cos(M_PI * pos) + 1) / 2);
155 colVal =
CAST_S32(255.0 * (cos(M_PI *
156 (delay - pos) / delay) + 1) / 2);
160 colVal =
CAST_S32(255.0 * (cos(M_PI *
161 (delay - pos)) + 1) / 2);
165 color.
r = (colIndex == 0 || colIndex == 5) ? 255 :
166 (colIndex == 1 || colIndex == 4) ? colVal : 0;
167 color.
g = (colIndex == 1 || colIndex == 2) ? 255 :
168 (colIndex == 0 || colIndex == 3) ? colVal : 0;
169 color.
b = (colIndex == 3 || colIndex == 4) ? 255 :
170 (colIndex == 2 || colIndex == 5) ? colVal : 0;
181 startColVal = (cos(M_PI * pos / delay) + 1) / 2;
185 destColVal = 1 - startColVal;
188 * startCol.
r + destColVal * destCol.
r);
191 * startCol.
g + destColVal * destCol.
g);
194 * startCol.
b + destColVal * destCol.
b);
const Color & getCharColor(const signed char c, bool &valid) const
std::set< Palette * > Palettes
static const Color RAINBOW_COLORS[7]
static const int RAINBOW_COLOR_COUNT
static Palettes mInstances
static void advanceGradients()
std::vector< ColorElem * > mGradVector
std::vector< ColorElem > Colors
#define FOR_EACH(type, iter, array)
GradientType ::T GradientTypeT
std::map< std::string, DyeColor > mColors
int get_elapsed_time(const int startTime)