25 #define POS_TEX_BINDING 0
26 #define COLOUR_BINDING 1
32 : TextAreaOverlayElement(name)
45 mColoursChanged =
true;
51 mColoursChanged =
true;
59 return ColourValue(0, 0, 0);
61 return ColourValue(Value, 0, 0);
63 return ColourValue(0, Value, 0);
65 return ColourValue(Value, Value, 0);
67 return ColourValue(0, 0, Value);
69 return ColourValue(0, Value, Value);
71 return ColourValue(Value, 0, Value);
73 return ColourValue(Value, Value, Value);
75 return ColourValue(Value * 0.9, Value * 0.9, Value * 0.9);
77 return ColourValue(0.5, 0.5, Value * 0.9);
79 return ColourValue::Black;
86 DisplayString text = DisplayString(otext.c_str());
87 DisplayString StrippedText;
89 for (i = 0; i < (int)text.size() - 1; ++i)
92 text[i + 1] >=
'0' && text[i + 1] <=
'9')
98 StrippedText.append(1, text[i]);
102 if (i < (
int)text.size())
103 StrippedText.append(1, text[i]);
109 return String(
"UTF8 error (String cannot be displayed with current font set)");
117 int i, iNumColorCodes = 0, iNumSpaces = 0;
118 for (i = 0; i < (int)text.size() - 1; ++i)
120 if (text[i] ==
' ' || text[i] ==
'\n')
125 else if (text[i] ==
'^' &&
126 text[i + 1] >=
'0' && text[i + 1] <=
'9')
130 fill(
m_Colors.begin() + i - (2 * iNumColorCodes) - iNumSpaces,
m_Colors.end(), text[i + 1] -
'0');
133 mColoursChanged =
true;
138 mColoursChanged =
true;
140 TextAreaOverlayElement::setCaption(
StripColors(text));
145 if (!mRenderOp.vertexData)
148 RGBA topColour, bottomColour;
150 Root::getSingleton().convertColourValue(ColourValue::White, &topColour);
151 Root::getSingleton().convertColourValue(ColourValue::White, &bottomColour);
153 HardwareVertexBufferSharedPtr vbuf =
154 mRenderOp.vertexData->vertexBufferBinding->getBuffer(
COLOUR_BINDING);
158 RGBA* pDest = (RGBA*)malloc(vbuf->getSizeInBytes());
161 for (
size_t i = 0; i < mAllocSize; ++i)
170 *pDest++ = topColour;
171 *pDest++ = bottomColour;
172 *pDest++ = topColour;
174 *pDest++ = topColour;
175 *pDest++ = bottomColour;
176 *pDest++ = bottomColour;
178 vbuf->writeData(0, vbuf->getSizeInBytes(), oDest,
true);