Attempt at fixing window and bgfx reinit
Some checks failed
build-and-test / build (push) Failing after 1m32s
build-and-test / test (push) Failing after 1m48s
build-and-test / generate-javadoc (push) Failing after 4m47s

This commit is contained in:
JeremyStar™ 2024-12-01 21:11:46 +01:00
parent ec1dcb734a
commit 92aa012738
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 12 additions and 3 deletions

View file

@ -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.Miscellaneous;
import de.staropensource.engine.base.utility.misc.NumberUtil; 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.RenderingSubsystemConfiguration;
import de.staropensource.engine.rendering.exception.NotOnMainThreadException; import de.staropensource.engine.rendering.exception.NotOnMainThreadException;
import de.staropensource.engine.rendering.type.FrameHandler; import de.staropensource.engine.rendering.type.FrameHandler;
@ -343,6 +344,7 @@ public final class Renderer {
@SuppressWarnings({ "InfiniteLoopStatement" }) @SuppressWarnings({ "InfiniteLoopStatement" })
private static void render() { private static void render() {
while (true) { while (true) {
RenderingCode.updateWindowStates();
RenderingCode.resetFrame(); RenderingCode.resetFrame();
RenderingCode.invokeFrameHandlers(); RenderingCode.invokeFrameHandlers();
RenderingCode.renderWindows(); RenderingCode.renderWindows();

View file

@ -103,6 +103,15 @@ final class RenderingCode {
private static long timesPSO = System.currentTimeMillis() + 1000; 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. * Resets all frame data.
* *
@ -137,10 +146,8 @@ final class RenderingCode {
// Render all windows // Render all windows
for (Window window : Window.getWindows()) for (Window window : Window.getWindows())
if (window.isRendering()) { if (window.isRendering())
window.updateState();
window.render(); window.render();
}
// Advance to next frame // Advance to next frame
bgfx_frame(false); bgfx_frame(false);