rotating menu with Actors in libgdx
- by joecks
I am intending to build a circular menu, with menu items equally distributed around the circle. When clicking on a menu item the circle should rotate so that the selected item is facing the top. I am using libgdx and I am not very familiar with the Actors concept, so I intuitivly tried to implement an Actor, who is drawing a texture and then transforming it by using Actions, with no success:
class CircleActor extends Actor {
@Override
public void draw(SpriteBatch batch, float parentAlpha) {
batch.draw(texture1, 100, 100);
}
@Override
public Actor hit(float x, float y) {
return this;
}
}
and the rotate action:
CircleActor circleActor = new CircleActor();
circleActor.action(Forever.$(RotateBy.$(0.1f, 0.1f)));
// stage.addActor();
stage.addActor(circleActor);
The texture is rectangular, but it doe not work. 1. What is wrong? 2. Is it a good approach to solve the task?
Thanks!