diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 1c36954a..5b08e163 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1328,6 +1328,7 @@ Fix block meshgen algorithm iteration bug Add debug control to swap first/third person Setup scaffolding for drag-and-drop asset handling Editor mode asset file drag and drop +Editor mode pauses simulation diff --git a/src/main/java/electrosphere/client/ui/menu/editor/ImGuiEditorWindows.java b/src/main/java/electrosphere/client/ui/menu/editor/ImGuiEditorWindows.java index 99cb6f78..5248eadb 100644 --- a/src/main/java/electrosphere/client/ui/menu/editor/ImGuiEditorWindows.java +++ b/src/main/java/electrosphere/client/ui/menu/editor/ImGuiEditorWindows.java @@ -2,6 +2,7 @@ package electrosphere.client.ui.menu.editor; import electrosphere.controls.ControlHandler.ControlsState; import electrosphere.engine.Globals; +import electrosphere.engine.Main; import electrosphere.renderer.ui.imgui.ImGuiWindow; import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback; import imgui.ImGui; @@ -62,8 +63,10 @@ public class ImGuiEditorWindows { ImGuiEditorWindows.editorIsOpen = mainWindow.isOpen(); if(mainWindow.isOpen()){ Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_MAIN_MENU); + Main.setFramestep(Main.FRAMESTEP_PAUSE); } else { Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME); + Main.setFramestep(Main.FRAMESTEP_AUTO); } //toggle all windows diff --git a/src/main/java/electrosphere/engine/Main.java b/src/main/java/electrosphere/engine/Main.java index 73db5ed9..03045e28 100644 --- a/src/main/java/electrosphere/engine/Main.java +++ b/src/main/java/electrosphere/engine/Main.java @@ -33,7 +33,21 @@ public class Main { - + /** + * Pauses simulation + */ + public static final int FRAMESTEP_PAUSE = 0; + + /** + * Simulates a single frame + */ + public static final int FRAMESTEP_SINGLE = 1; + + /** + * Toggles automatic simulation + */ + public static final int FRAMESTEP_AUTO = 2; + @@ -50,6 +64,7 @@ public class Main { //framestep variable static int framestep = 2; + public static void main(String args[]){