Skip to content

Commit 414b2bc

Browse files
committed
Draw texture for bg and button of CloseChoicePopup
Todo{ Add logger }
1 parent 6304ac4 commit 414b2bc

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/main/java/fr/ostix/game/gui/MasterGui.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static void addGuiByModel(GuiTexture g) {
7272
List<GuiTexture> batch2 = guisByModel.get(model);
7373
if (batch2 != null) {
7474
batch2.add(g);
75-
}else{
75+
} else {
7676
List<GuiTexture> newBatch = new ArrayList<>();
7777
newBatch.add(g);
7878
guisByModel.put(g.getModel(), newBatch);
@@ -86,6 +86,9 @@ public static void removeGuiByModel(GuiTexture g) {
8686
List<GuiTexture> batch = guisByModel.get(model);
8787
if (batch != null) {
8888
batch.remove(g);
89+
if (batch.isEmpty()) {
90+
guisByModel.remove(model);
91+
}
8992
}
9093
}
9194

src/main/java/fr/ostix/game/menu/ingame/CloseChoicePopup.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public class CloseChoicePopup extends Screen {
2121

2222
public CloseChoicePopup(String title, String question, Button.IPressable yesCallback, Button.IPressable noCallback) {
2323
super(title);
24-
yes = new HorizontalButton(1100,900,200,100,
24+
yes = new HorizontalButton(1100,800,200,120,
2525
ResourcePack.getTextureByName("yes").getID(), yesCallback);
26-
no = new HorizontalButton(450,900,200,100,
26+
no = new HorizontalButton(460,800,200,120,
2727
ResourcePack.getTextureByName("no").getID(), noCallback);
28-
background = new GuiTexture(ResourcePack.getTextureByName("closeChoice").getID(),
29-
new Vector2f(400, 300),new Vector2f(1000, 750));
28+
background = new GuiTexture(ResourcePack.getTextureByName("closeChoiceBG").getID(),
29+
new Vector2f(540, 250),new Vector2f(700, 550));
3030
this.question = new GUIText(question, 1, Game.gameFont, new Vector2f(700, 500),
3131
600, false);
3232
}
@@ -36,6 +36,10 @@ public void init() {
3636
super.init();
3737
MasterGui.addGui(background);
3838
MasterFont.add(question);
39+
}
40+
41+
@Override
42+
public void open() {
3943
this.addComponent(yes);
4044
this.addComponent(no);
4145
}

0 commit comments

Comments
 (0)