This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.Stack;
|
||||
|
||||
import imgui.ImGui;
|
||||
import imgui.ImVec2;
|
||||
import imgui.flag.ImGuiKey;
|
||||
import imgui.flag.ImGuiWindowFlags;
|
||||
|
||||
public class StateMachine {
|
||||
@@ -22,6 +23,12 @@ public class StateMachine {
|
||||
menus.pop();
|
||||
}
|
||||
|
||||
private void checkEscape() {
|
||||
if (ImGui.isKeyPressed(ImGuiKey.Escape) && menus.size() > 1) {
|
||||
popState();
|
||||
}
|
||||
}
|
||||
|
||||
public void render() {
|
||||
var displaySize = ImGui.getIO().getDisplaySize();
|
||||
ImGui.setNextWindowPos(new ImVec2(0.0f, 0.0f));
|
||||
@@ -30,6 +37,7 @@ public class StateMachine {
|
||||
| ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoBackground);
|
||||
menus.getLast().render();
|
||||
ImGui.end();
|
||||
checkEscape();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user