Skip to content

UI components

miguel edited this page Mar 15, 2019 · 3 revisions

This framework has a set of UI components which can be used directly in your game.

NavigationMenu

a horizontal or vertical button menu which can be controlled with mouse, controller and keyboard.

Example:

// Initialisation
ButtonMenu buttonMenu = new ButtonMenu(context.getTweenManager());
buttonMenu.add("button 1", new ClickListener() {
   @Override
   public void clicked(InputEvent event, float x, float y) {
      // action A
   }
});
buttonMenu.add("button 2", new ClickListener() {
   @Override
   public void clicked(InputEvent event, float x, float y) {
      // action B
   }
});
// Wiring input
context.getInputManager().register(new NavigateableKeyboardInput(buttonMenu));
context.getInputManager().register(new NavigateableControllerInput(buttonMenu));
// Adding menu to stage
context.getStage().add(buttonMenu);
Clone this wiki locally