0

i´m trying to made a couple screens like a menu or a pause, and in these screens i want to put some "other screens", for example in my menu i want a button options and then the app slides and shows another screen with options like music/volume, or like a castlevania/megaman game when the user pause the game, some options are displayed, change the inventory, buy an hability or something like that, in this case when we try to manage the inventory the screen change an shows the information about the current inventory, so my question is how is managed this on libgdx, because i know there is a screen class but is that the way to do it?, constantly change between screens or there's another way.

J Sierra
  • 51
  • 1
  • 6

1 Answers1

0

This is actually what you need scene2D.

scene2d is well equipped for laying out, drawing, and handling input for game menus, HUD overlays, tools, and other UIs. The scene2d.ui package provides many actors and other utilities specifically for building UIs.

Lets assume you know about Stage which you will need to add your Actors like(buttons,textfield,input) all you have to do is implement Table, part of scene2D that contains method such as setVisible.

Lets say for example this is your log-in HUD. Now you want to hide it when a button is clicked.

Table table = new Table();
table.add(textField);
table.add(logInButton);
stage.addActor(table);

if(hideButton.isChecked())
{
  table.setvisible(false)
}
else
{ 
 table.setVisible(true)
}

This will hide all your Actors that contains in your table.

Sparcsky
  • 377
  • 3
  • 15