我用Stage
在libGDX
绘制图形用户界面,并在我的游戏中添加监听器控制。
但是,当我在ImageTextButton上绘制文本时,得到的镜像文本如下图所示。
可以帮助我,告诉我如何绘制普通文本,而不是镜像文本吗?
stage = new Stage(Constants.VIEWPORT_GUI_WIDTH, Constants.VIEWPORT_GUI_HEIGHT);
stage.clear();
....
ImageTextButtonStyle imageTextButtonStyle = new ImageTextButtonStyle();
imageTextButtonStyle.font = Assets.instance.fonts.defaultSmall;
ImageTextButton imageTextButton = new ImageTextButton("ddsds", imageTextButtonStyle);
imageTextButton.setBackground( gameUISkin.getDrawable("fil_coins"));
imageTextButton.setPosition(50, 600);
imageTextButton.setHeight(85);
imageTextButton.setWidth(183);
stage.addActor(imageTextButton);
....
public void render (float deltaTime) {
stage.act(deltaTime);
stage.draw();
}
谢谢
编辑:按钮图像显示正确,只有文本具有镜像视图
正如@Springrbua在下面的评论中建议我的那样,我的位图字体在创建时被翻转了。
defaultSmall = new BitmapFont(Gdx.files.internal("images/font.fnt"), true);
应该
defaultSmall = new BitmapFont(Gdx.files.internal("images/font.fnt"), false);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句