libGDX阶段绘制镜像文本

时间:2014-02-16 23:08:53

标签: libgdx

我在Stage中使用libGDX绘制GUI并在游戏中添加侦听器。

但是当我在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();
    }

mirrored text

由于

编辑: 按钮图像显示正确,只有文本具有镜像视图

2 个答案:

答案 0 :(得分:4)

正如@Springrbua在下面的评论中建议的那样,我的位图字体在创建时被翻转了。

defaultSmall = new BitmapFont(Gdx.files.internal("images/font.fnt"), true);

应该是

defaultSmall = new BitmapFont(Gdx.files.internal("images/font.fnt"), false);

答案 1 :(得分:2)

即使不是这种情况,它也可能对某人有用 - 如果将字体大小参数设置为负值,则文本将呈现为倒置(Y尺度)。