Closed ecj2 closed 6 years ago
Here is an example function I wrote that draws multiple lines of text on top of each other and splits the lines whenever a line break ("\n") appears:
function drawMultipleLinesOfText(font, fill_color, size, x, y, alignment, text, outline_color = undefined, outline_width = 0) {
let lines = text.split("\n");
let i = 0;
let number_of_lines = lines.length;
for (i; i < number_of_lines; ++i) {
Momo.drawText(font, fill_color, size, x, y + (size * i), alignment, lines[i], outline_color, outline_width);
}
}
The above is a good starting point, but I am not entirely sure that a one-size-fits-all solution would be well-suited to Momo. It might be best that the library not include such functionality, and instead allow users to roll their own implementations.
Users are likely better off rolling their own implementations.
It would be convenient to be able to draw multiple lines of text through the use of one method call.
So instead of:
Just do:
Maybe the line break character could be specified in the method as well.