diff --git a/src/Modules/Editor.bf b/src/Modules/Editor.bf index f97065b..db8aa0e 100644 --- a/src/Modules/Editor.bf +++ b/src/Modules/Editor.bf @@ -15,9 +15,9 @@ namespace Strawberry protected override void Render() { - PlatformLayer.EditorRenderBegin(); + PlatformLayer.ImGuiRenderBegin(); UI(); - PlatformLayer.EditorRenderEnd(); + PlatformLayer.ImGuiRenderEnd(); PlatformLayer.RenderEnd(); } diff --git a/src/Modules/Game.bf b/src/Modules/Game.bf index 24c5c2b..892f391 100644 --- a/src/Modules/Game.bf +++ b/src/Modules/Game.bf @@ -99,9 +99,9 @@ namespace Strawberry if (DebugOverlay) { - PlatformLayer.EditorRenderBegin(); + PlatformLayer.ImGuiRenderBegin(); DebugOverlay(); - PlatformLayer.EditorRenderEnd(); + PlatformLayer.ImGuiRenderEnd(); } PlatformLayer.RenderEnd(); diff --git a/src/Modules/Module.bf b/src/Modules/Module.bf index 073c24b..94dfbd4 100644 --- a/src/Modules/Module.bf +++ b/src/Modules/Module.bf @@ -14,7 +14,7 @@ namespace Strawberry PlatformLayer = platformLayer; } - public Module Run() + private Module Run() { Time.RawPreviousElapsed = 0; Time.RawElapsed = 0; @@ -22,6 +22,8 @@ namespace Strawberry Time.Elapsed = 0; Time.Freeze = 0; + Started(); + while (true) { let tick = PlatformLayer.Ticks; diff --git a/src/PlatformLayer/PlatformLayer.bf b/src/PlatformLayer/PlatformLayer.bf index 9379a00..c389611 100644 --- a/src/PlatformLayer/PlatformLayer.bf +++ b/src/PlatformLayer/PlatformLayer.bf @@ -28,10 +28,10 @@ namespace Strawberry public abstract bool Closed(); // Returns whether the game window has been closed //Rendering - public abstract void EditorRenderBegin(); - public abstract void EditorRenderEnd(); public abstract void GameRenderBegin(); public abstract void GameRenderEnd(); + public abstract void ImGuiRenderBegin(); + public abstract void ImGuiRenderEnd(); public abstract void RenderEnd(); //Update diff --git a/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf b/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf index 50dd675..b21eba4 100644 --- a/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf +++ b/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf @@ -171,14 +171,14 @@ namespace Strawberry.SDL2 public override uint32 Ticks => SDL.GetTicks(); - public override void EditorRenderBegin() + public override void ImGuiRenderBegin() { ImGuiImplOpenGL3.NewFrame(); ImGuiImplSDL2.NewFrame(window); ImGui.NewFrame(); } - public override void EditorRenderEnd() + public override void ImGuiRenderEnd() { ImGui.Render(); ImGuiImplOpenGL3.RenderDrawData(ImGui.ImGui.GetDrawData()); diff --git a/src/Static/Engine.bf b/src/Static/Engine.bf index 772d679..750e21e 100644 --- a/src/Static/Engine.bf +++ b/src/Static/Engine.bf @@ -7,23 +7,12 @@ namespace Strawberry { Startup(); - Module current = module; - current.[Friend]Started(); - while (true) + Module currentModule = module; + while (currentModule != null) { - let newModule = current.Run(); - - if (newModule != null) - { - delete current; - current = newModule; - current.[Friend]Started(); - } - else - { - delete current; - break; - } + let newModule = currentModule.[Friend]Run(); + delete currentModule; + currentModule = newModule; } Shutdown();