From 92aa012738185ce658907a6fe5e39510a49d0ebe Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 1 Dec 2024 21:11:46 +0100 Subject: [PATCH] Attempt at fixing window and bgfx reinit --- .../engine/rendering/renderer/Renderer.java | 2 ++ .../engine/rendering/renderer/RenderingCode.java | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java index fa2f5e5..8a5e222 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java @@ -21,6 +21,7 @@ package de.staropensource.engine.rendering.renderer; import de.staropensource.engine.base.utility.misc.Miscellaneous; import de.staropensource.engine.base.utility.misc.NumberUtil; +import de.staropensource.engine.rendering.RenderingSubsystem; import de.staropensource.engine.rendering.RenderingSubsystemConfiguration; import de.staropensource.engine.rendering.exception.NotOnMainThreadException; import de.staropensource.engine.rendering.type.FrameHandler; @@ -343,6 +344,7 @@ public final class Renderer { @SuppressWarnings({ "InfiniteLoopStatement" }) private static void render() { while (true) { + RenderingCode.updateWindowStates(); RenderingCode.resetFrame(); RenderingCode.invokeFrameHandlers(); RenderingCode.renderWindows(); diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java index 5ede7e7..68bd78d 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java @@ -103,6 +103,15 @@ final class RenderingCode { private static long timesPSO = System.currentTimeMillis() + 1000; + /** + * Updates the states of all windows. + * + * @since v1-alpha0 + */ + public static void updateWindowStates() { + for (Window window : Window.getWindows()) + window.updateState(); + } /** * Resets all frame data. * @@ -137,10 +146,8 @@ final class RenderingCode { // Render all windows for (Window window : Window.getWindows()) - if (window.isRendering()) { - window.updateState(); + if (window.isRendering()) window.render(); - } // Advance to next frame bgfx_frame(false);