Skip to content

Commit

Permalink
Changed variables for sldier table and button table for better code r…
Browse files Browse the repository at this point in the history
…eadability
  • Loading branch information
shiv-0831 committed Sep 30, 2023
1 parent 92228da commit 32e6465
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
public class UIElementsDisplay extends UIComponent {
private static final Logger logger = LoggerFactory.getLogger(MainGameExitDisplay.class);
private static final float Z_INDEX = 2f;
private Table table;
private Table buttonTable;
private Table sliderTable;

@Override
public void create() {
Expand All @@ -27,9 +28,12 @@ public void create() {
}

private void addActors() {
table = new Table();
table.top();
table.setFillParent(true);
buttonTable = new Table();
sliderTable = new Table();
buttonTable.top().right();
sliderTable.top();
buttonTable.setFillParent(true);
sliderTable.setFillParent(true);

TextButton remainingMobsButton = new ButtonFactory().createButton("Remaining mobs:");
TextButton testSlider = new ButtonFactory().createButton("Test slider");
Expand All @@ -44,10 +48,11 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
}
});

table.add(remainingMobsButton).padTop(0f).padRight(100f);
table.add(testSlider).padTop(10).padRight(10f);
buttonTable.add(remainingMobsButton).padRight(50f);
sliderTable.add(testSlider).padTop(200f);

stage.addActor(table);
stage.addActor(buttonTable);
stage.addActor(sliderTable);
}

@Override
Expand All @@ -62,7 +67,8 @@ public float getZIndex() {

@Override
public void dispose() {
table.clear();
buttonTable.clear();
sliderTable.clear();
super.dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ private void createUI() {
.addComponent(new PerformanceDisplay())
.addComponent(new MainGameActions(this.game))
.addComponent(new MainGameExitDisplay())
.addComponent(new UIElementsDisplay())
.addComponent(new MainGameLoseDisplay())
.addComponent(new UIElementsDisplay())
.addComponent(new MainGameLoseDisplay())
.addComponent(new Terminal())
.addComponent(inputComponent)
.addComponent(new TerminalDisplay());
Expand Down

0 comments on commit 32e6465

Please sign in to comment.