diff --git a/src/JSON/JSON.bf b/src/JSON/JSON.bf index 4864583..0b897c4 100644 --- a/src/JSON/JSON.bf +++ b/src/JSON/JSON.bf @@ -396,13 +396,6 @@ namespace Strawberry static public JSON FromFile(String filePath) { FileStream stream = scope FileStream(); - - let str = scope String(); - Directory.GetCurrentDirectory(str); - Calc.Log(str); - - - if (stream.Open(filePath, .Read) case .Err) Runtime.FatalError("Unable to open FileStream"); let json = FromStream(stream); diff --git a/src/Modules/Game.bf b/src/Modules/Game.bf index 5ae4330..24c5c2b 100644 --- a/src/Modules/Game.bf +++ b/src/Modules/Game.bf @@ -88,12 +88,6 @@ namespace Strawberry { if (scene != null) scene.Update(); - - Time.RawPreviousElapsed = Time.RawElapsed; - Time.RawElapsed += Time.RawDelta; - - Time.PreviousElapsed = Time.Elapsed; - Time.Elapsed += Time.Delta; } } @@ -138,10 +132,5 @@ namespace Strawberry { } - - public virtual Editor CreateEditor() - { - return null; - } } } diff --git a/src/Modules/Module.bf b/src/Modules/Module.bf index b762ba8..073c24b 100644 --- a/src/Modules/Module.bf +++ b/src/Modules/Module.bf @@ -16,6 +16,12 @@ namespace Strawberry public Module Run() { + Time.RawPreviousElapsed = 0; + Time.RawElapsed = 0; + Time.PreviousElapsed = 0; + Time.Elapsed = 0; + Time.Freeze = 0; + while (true) { let tick = PlatformLayer.Ticks; @@ -41,6 +47,14 @@ namespace Strawberry Input.AfterUpdate(); } + //Update elapsed + { + Time.RawPreviousElapsed = Time.RawElapsed; + Time.RawElapsed += Time.RawDelta; + Time.PreviousElapsed = Time.Elapsed; + Time.Elapsed += Time.Delta; + } + // render Render(); @@ -58,6 +72,7 @@ namespace Strawberry } } + protected abstract void Started(); protected abstract void Update(); protected abstract void Render(); diff --git a/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf b/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf index 3b8bee7..50dd675 100644 --- a/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf +++ b/src/PlatformLayer/SDL2/SDL2PlatformLayer.bf @@ -194,8 +194,8 @@ namespace Strawberry.SDL2 public override void GameRenderEnd() { - GL.glUseProgram(0); GL.glFlush(); + GL.glUseProgram(0); } public override void RenderEnd() diff --git a/src/Static/Engine.bf b/src/Static/Engine.bf index 699f688..772d679 100644 --- a/src/Static/Engine.bf +++ b/src/Static/Engine.bf @@ -8,6 +8,7 @@ namespace Strawberry Startup(); Module current = module; + current.[Friend]Started(); while (true) { let newModule = current.Run(); @@ -16,6 +17,7 @@ namespace Strawberry { delete current; current = newModule; + current.[Friend]Started(); } else {