【发布时间】:2017-08-10 07:22:06
【问题描述】:
我想旋转一个按钮。于是我写了如下代码:
public void show () {
skin2 = new Skin (Gdx.files.internal("SettingsButton.json"));
button2 = new Button(skin2);
button2.setPosition(25,1440);
button2.setSize(120,120);
button2.setOrigin(button2.getWidth() / 2, button2.getHeight() / 2);
button2.addAction(Actions.repeat(RepeatAction.FOREVER,
Actions.sequence(
Actions.rotateBy(360, 1),
Actions.rotateTo(0))));
button2.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new SettingsScreen(game));
super.clicked(event, x, y);
}
});
stage.addActor(button2);
}
不幸的是,按钮没有旋转,但我不知道为什么。 如何改进我的代码?
【问题讨论】:
标签: java android button libgdx rotation