我有引号的字符串数组,想要在libgdx中显示。我正在做如下
public int quoteIndexNo =2;
public String[] quotes = {
"Sometimes the heart sees what is " +
"invisible to the eye. H. Jackson " +
"Brown, Jr.",
"Being deeply loved by someone gives" +
" you strength, while loving someone " +
"deeply gives you courage. Lao Tzu",};
font.draw(batch, quotes[quoteIndexNo], 50, 100);
但问题是,文字很大,它没有在屏幕上正确显示。 我怎样才能确保单行中只能看到15个字符,而另一行中的字符串部分是可见的。
答案 0 :(得分:2)
使用drawMultiLine。在你的情况下使用它像这样 font.drawMultiLine(batch,lovequotes [quoteIndexNo],50,150); 可能这会帮助你