1

So i found a toolkit to create VisualNovels but it uses

        font.drawMultiLine(
               batch,
               previous.toString() + current.substring(0, c),
               dx, dy);

And

  else if (font.getBounds(test + words[i] + " ").width <= LINE_LENGTH) {
            if (i == (total - 1)){
                line.append(words[i]);
                linesArray.add(line.toString());
                lines++;
            }else
                line.append(words[i] + " ");
           }else if (font.getBounds(test + words[i] + " ").width > LINE_LENGTH){
                linesArray.add(test);
                line.replace(0, line.length(), words[i] + " ");
                lines++;

I'm Kinda new to Java and I don't know how to change all that code into what the wiki says:

http://www.badlogicgames.com/wordpress/?p=3658

It says that i should replace getBounds with Glyph but getBounds is not commented and I'm not sure what it does

Darkly
  • 347
  • 3
  • 18
  • By the way this is the toolkit:https://github.com/0xCA2/Visual-Novel-Toolkit/blob/master/core/src/com/oxca2/cyoat/AnimatedText.java – Darkly Jan 31 '16 at 01:33

1 Answers1

2

According to the deprecation instructions, instead of

font.getBounds(myText).width

you should use:

new GlyphLayout(font, myText).width 

(This is just a pointer; you should optimize it and not create new objects every time)

muratgu
  • 6,949
  • 3
  • 22
  • 26