drawText method
void
drawText(
- String text,
- Matrix4 mMatrix, {
- Vector4? color,
})
Implementation
void drawText(String text, Matrix4 mMatrix, {Vector4? color}) {
Vector3 offset = Vector3.zero();
for (int i = 0; i < text.length; i++) {
final char = text[i];
if (char == '\n') {
offset.x = 0;
offset.y += spriteH;
} else {
final charIndex = char.codeUnitAt(0) - firstChar;
final textMatrix = Matrix4.copy(mMatrix);
textMatrix.translateByVector3(offset);
// draw sprite by index
super.draw(textMatrix, index: charIndex, color: color);
offset.x += cellW;
}
}
}