Vous pouvez créer votre propre version d'un ImageButton en étendant la classe Actor et en implémentant vos propres méthodes de dessin. L'exemple ci-dessous n'est pas testé mais devrait vous donner et idée sur la façon de faire votre propre bouton personnalisé:
private class LayeredButton extends Actor{
private int width = 100;
private int height = 75;
private Texture backGround;
private Texture foreGround;
private Texture outline;
public LayeredButton(Texture bg, Texture fg, Texture ol){
setBounds(this.getX(),this.getY(),this.width,this.height);
backGround = bg;
foreGround = fg;
outline = ol;
addListener(new InputListener(){
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
// do something on click here
return true;
}
});
}
@Override
public void draw(Batch batch, float alpha){
// draw from back to front
batch.draw(backGround,this.getX(),this.getY());
batch.draw(foreGround,this.getX(),this.getY());
batch.draw(outline,this.getX(),this.getY());
}
@Override
public void act(float delta){
// do stuff to button
}
}
C'est en fait une idée brillamment simple, redéfinissant la méthode 'draw'. Merci beaucoup. –