Thanks for those Multi-line edit changes !
Taking a quick peek, it looks like it would be very simple to have multiple colours by changing Text::ConstructBatch
, eg:
for (unsigned i = 0; i < pageGlyphLocation.Size(); ++i)
{
const GlyphLocation& glyphLocation = pageGlyphLocation[i];
const FontGlyph& glyph = *glyphLocation.glyph_;
pageBatch.SetColor(Color(((i * 5) % 255) / 255.0f, ((i * 15) % 255) / 255.0f, ((i * 25) % 255) / 255.0f));
pageBatch.AddQuad(dx + glyphLocation.x_ + glyph.offsetX_, dy + glyphLocation.y_ + glyph.offsetY_, glyph.width_,
glyph.height_, glyph.x_, glyph.y_);
}
With that in mind, it would be good to expose a light-weight multi-colour option (via code), eg: Text::SetColors(Vector<Color> colors, PODVector<unsigned> colorVector, unsigned firstCharacter = 0)
where in the case of a large file code editor, you would want to use the firstCharacter option to narrow the range and update colours for what can be seen only. I may submit a PR for this.
This could work well even for implementing the classic type-writer effect in many games, by tweaking the alphas on the colours, avoiding the typical word-wrap popping bug of messier implementations.