0
私はTextButton
を使用してゲームでバブルの効果を作り出しています。 画像のように9個のパッチファイルを作成しました このbubble.9をLibGDXで使用しようとするまで、すべてが正常であるようですが、TextButton
はテキストの高さに基づいて正しく伸びていません。Libgdx 9パッチのテキストボタンの高さの問題
あなたはマルチラインテキストがTextButton
高さを拡張ではなく、正しくことがわかります。ここで
dialogBox = new TextButton("some\ntext", buttonStyle);
dialogBox.draw(batch, 1);
をレンダリング
FileHandleResolver resolver = new InternalFileHandleResolver();
assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
assetManager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));
FreetypeFontLoader.FreeTypeFontLoaderParameter dialogFont = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
dialogFont.fontFileName = Conf.ASSET_FONT;
dialogFont.fontParameters.size = 8;
がTextButtonStyle
NinePatch patch = atlas.createPatch("bubble");
NinePatchDrawable dialogBoxPatch = new NinePatchDrawable(patch);
buttonStyle = new TextButton.TextButtonStyle();
buttonStyle.up = dialogBoxPatch;
buttonStyle.down = dialogBoxPatch;
buttonStyle.checked = dialogBoxPatch;
buttonStyle.over = dialogBoxPatch;
buttonStyle.font = dialogFont;
buttonStyle.fontColor = Color.BLACK;
実際の初期化コード
負荷ビットマップフォントです問題は?