at early stage of game development i use static string arrays for ingame text. but in matter of porting its annoying to format the text so that it fits to the screen's size.
therefore i have now written a tool-class which gets a loooong string and breaks it into several suitable for the given size parameter.
so a file with text resources is read as UTF-8 strings in a temporary array, each string is formatted by the tool class and returned as string-array, in which every string fits the screen perfectly.
so up to now a code snippet would look like this (a little pseudo =)
String helpTxt, introTxt ... (class global)
public void doit()
String wholeText = io.readTextResources();
helpTxt = formatterTool.tokenize(wholeText);
introTxt = formatterTool.tokenize(wholeText);
so far, so good.
now there are several things, which give me a headache.
first of all, i dont like the idea that every(!) sentence gets in a array, even if it doesnt need more than one line. e.g.
the words "youve won" will fit on every device. but at loading time i dont know it and have to catch the tokenized string array.
next thing is, i feel a little like after a bad deal to replace fine performant string-constants with real string arrays.
this will fill up the heap.
ive thought about loading all text snippet on demand but there is too much text, which is used rather often and loading from records really slows some devices down.
there are quite some other problems, but its enough for the moment ... =)
im very interested how you solve this very common (i think) problem.