1

我有引号字符串数组,想在 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 个字符可见,而字符串的其余部分在另一行中可见。

4

1 回答 1

2

使用 drawMultiLine 。在您的情况下,像这样使用它 font.drawMultiLine(batch, lovequotes[quoteIndexNo], 50 ,150 ); 可能这会帮助你

于 2013-04-10T11:21:36.103 回答