【发布时间】:2017-04-18 19:29:35
【问题描述】:
我正在尝试为我的游戏制作控件,总共只有四个按钮,右下角 2 个,左下角 1 个,右上角 1 个,但是皮肤非常拉伸并且行为怪异。我尝试了libgdx skin repository 的不同皮肤,它们的行为都不同,有些向右拉伸很多,有些则很大。这是我的代码:
table = new Table();
boostButtonSkin = new Skin(Gdx.files.internal("star-soldier/skin/star-soldier-ui.json"));
boostButton = new ImageButton(boostButtonSkin);
table.setWidth(stage.getCamera().viewportWidth);
table.setHeight(stage.getCamera().viewportHeight);
table.setDebug(true);
table.bottom().left();
table.add(boostButton).width(2).height(2);
stage.addActor(table);
视口宽度和高度分别为 40、24。
【问题讨论】: