The main reason it's slow is because each line/string is drawn using separate glBegin/glEnd calls to OpenGL. Basically this means each string of text is being pushed to the GPU individually. In order to improve performance, you would send all of the lines of text in a single batch. In Slick, the general way to resolve this is by using startUse/drawEmbedded/endUse -- but this is only available for images (and by extension AngelCodeFont, which has the glyph class exposed).
Also note that there is a strange
bug/limitation/quirk on certain Macs which can greatly increase unicode font loading time.
There is no need to use Strings or UnicodeFonts to achieve this effect, though. The best way to do this is to use a sprite sheet image containing the various glyphs (in this case "0" and "1"), and render each glyph using drawEmbedded.
1 2 3 4 5 6 7
| glyphSheet.startUse();
... for each glyph in your entire background ... Image glyph = getRandomGlyph(); glyph.drawEmbedded(...);
glyphSheet.endUse(); |