LoginSignup
0
0

More than 5 years have passed since last update.

Cocos2d-x の2系かつ Android だと半角スペースで改行される

Posted at

取り急ぎ調べただけなのでメモ。

表題の件、原因はCocos2dxBitmap.javadivideStringWithMaxWidth 関数と思われる。

if (tempWidth >= pMaxWidth) {
    final int lastIndexOfSpace = pString.substring(0, i).lastIndexOf(" ");

    if (lastIndexOfSpace != -1 && lastIndexOfSpace > start) {
        /* Should wrap the word. */
        strList.add(pString.substring(start, lastIndexOfSpace));
        i = lastIndexOfSpace;
    } else {
        ...
    }
    ...
}

長さがオーバーしている場合は末尾の半角スペースで区切ってそこで1行としている(っぽい)。
おそらく英文想定の実装だと思われる。

3系だとこの処理はなくなっている。
https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0