More Module setup

This commit is contained in:
Maddy Thorson 2021-02-20 19:13:31 -08:00
parent bb7e3de917
commit bc2dfc73ce
6 changed files with 16 additions and 25 deletions

View File

@ -15,9 +15,9 @@ namespace Strawberry
protected override void Render()
{
PlatformLayer.EditorRenderBegin();
PlatformLayer.ImGuiRenderBegin();
UI();
PlatformLayer.EditorRenderEnd();
PlatformLayer.ImGuiRenderEnd();
PlatformLayer.RenderEnd();
}

View File

@ -99,9 +99,9 @@ namespace Strawberry
if (DebugOverlay)
{
PlatformLayer.EditorRenderBegin();
PlatformLayer.ImGuiRenderBegin();
DebugOverlay();
PlatformLayer.EditorRenderEnd();
PlatformLayer.ImGuiRenderEnd();
}
PlatformLayer.RenderEnd();

View File

@ -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;

View File

@ -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

View File

@ -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());

View File

@ -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();