Skip to content

Commit

Permalink
Created basic structure for reamaining mobs tile and wave time buffer…
Browse files Browse the repository at this point in the history
… button
  • Loading branch information
shiv-0831 committed Sep 30, 2023
1 parent 32e6465 commit c5d724f
Showing 1 changed file with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
public class UIElementsDisplay extends UIComponent {
private static final Logger logger = LoggerFactory.getLogger(MainGameExitDisplay.class);
private static final float Z_INDEX = 2f;
private Table buttonTable;
private Table sliderTable;
private Table buttonTable = new Table();
private Table sliderTable = new Table();
private Table timerTable = new Table();


@Override
public void create() {
Expand All @@ -28,30 +30,35 @@ public void create() {
}

private void addActors() {
buttonTable = new Table();
sliderTable = new Table();
buttonTable.top().right();
timerTable.top().right();
sliderTable.top();

buttonTable.setFillParent(true);
timerTable.setFillParent(true);
sliderTable.setFillParent(true);

TextButton remainingMobsButton = new ButtonFactory().createButton("Remaining mobs:");
TextButton remainingMobsButton = new ButtonFactory().createButton("Mobs left:");
TextButton timerButton = new ButtonFactory().createButton("Next wave:");
TextButton testSlider = new ButtonFactory().createButton("Test slider");

// Triggers an event when the button is pressed.
remainingMobsButton.addListener(
new ChangeListener() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
logger.debug("Wave counter button clicked");
entity.getEvents().trigger("wave counter");
}
});
//Not sure if we need a listened for a label
// // Triggers an event when the button is pressed.
// remainingMobsButton.addListener(
// new ChangeListener() {
// @Override
// public void changed(ChangeEvent changeEvent, Actor actor) {
// logger.debug("Wave counter button clicked");
// entity.getEvents().trigger("wave counter");
// }
// });

buttonTable.add(remainingMobsButton).padRight(50f);
buttonTable.add(remainingMobsButton).padTop(20f).padRight(10f);
timerTable.add(timerButton).padTop(70f).padRight(10f);
sliderTable.add(testSlider).padTop(200f);

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

Expand All @@ -68,6 +75,7 @@ public float getZIndex() {
@Override
public void dispose() {
buttonTable.clear();
timerTable.clear();
sliderTable.clear();
super.dispose();
}
Expand Down

0 comments on commit c5d724f

Please sign in to comment.