spawn popup at center

This commit is contained in:
2025-05-18 11:45:17 +02:00
parent fefb826b38
commit 1b31643f0b

View File

@@ -376,7 +376,9 @@ public class DDDView extends GameAdapter implements CommandSender {
} }
private void renderPopup(String title, String text) { private void renderPopup(String title, String text) {
if (ImGui.beginPopupModal(title, null, ImGuiWindowFlags.AlwaysAutoResize)) { ImVec2 center = ImGui.getMainViewport().getCenter();
ImGui.setNextWindowPos(center, ImGuiCond.Appearing, new ImVec2(0.5f, 0.5f));
if (ImGui.beginPopupModal(title, null, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoMove)) {
ImGui.text(text); ImGui.text(text);
if (ImGui.button("Close")) { if (ImGui.button("Close")) {
ImGui.closeCurrentPopup(); ImGui.closeCurrentPopup();