Skip to content

Commit

Permalink
removed redundant code from UIElementsDisplay, added the required but…
Browse files Browse the repository at this point in the history
…tons in the same table
  • Loading branch information
shiv-0831 committed Oct 1, 2023
1 parent bed9b98 commit 0ce57f4
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
public class UIElementsDisplay extends UIComponent {
private static final Logger logger = LoggerFactory.getLogger(MainGameExitDisplay.class);
private static final float Z_INDEX = 2f;
private final Table mobsButtonTable = new Table();
private final Table timerTable = new Table();
private final Table buttonTable = new Table();
private final Table towerTable = new Table();
Skin skin = new Skin(Gdx.files.internal("flat-earth/skin/flat-earth-ui.json"));
private TextButton remainingMobsButton = new ButtonFactory().createButton("Mobs left:");
Expand All @@ -38,12 +37,10 @@ public void create() {
* This method creates the buttons, adds them to the respective tables and draws them on the screen.
*/
private void addActors() {
mobsButtonTable.top().right();
timerTable.top().right();
buttonTable.top().right();
towerTable.top();

mobsButtonTable.setFillParent(true);
timerTable.setFillParent(true);
buttonTable.setFillParent(true);
towerTable.setFillParent(true);

towerTable.setDebug(true);
Expand All @@ -66,17 +63,17 @@ private void addActors() {
// }
// });

mobsButtonTable.add(remainingMobsButton).padTop(20f).padRight(10f);
timerTable.add(timerButton).padTop(70f).padRight(10f);
buttonTable.add(remainingMobsButton).padTop(10f).padRight(10f);
buttonTable.row();
buttonTable.add(timerButton).padRight(10f);

towerTable.add(tower1).padRight(10f);
towerTable.add(tower2).padRight(10f);
towerTable.add(tower3).padRight(10f);
towerTable.add(tower4).padRight(10f);
towerTable.add(tower5).padRight(10f);

stage.addActor(mobsButtonTable);
stage.addActor(timerTable);
stage.addActor(buttonTable);
stage.addActor(towerTable);
}

Expand Down Expand Up @@ -106,7 +103,7 @@ public float getZIndex() {
@Override
public void dispose() {
super.dispose();
mobsButtonTable.clear();
timerTable.clear();
buttonTable.clear();
towerTable.clear();
}
}

0 comments on commit 0ce57f4

Please sign in to comment.