Working on the module system more + some cleanup

This commit is contained in:
Maddy Thorson 2021-02-20 17:17:47 -08:00
parent bfd044544a
commit bb7e3de917
5 changed files with 18 additions and 19 deletions

View File

@ -396,13 +396,6 @@ namespace Strawberry
static public JSON FromFile(String filePath) static public JSON FromFile(String filePath)
{ {
FileStream stream = scope FileStream(); FileStream stream = scope FileStream();
let str = scope String();
Directory.GetCurrentDirectory(str);
Calc.Log(str);
if (stream.Open(filePath, .Read) case .Err) if (stream.Open(filePath, .Read) case .Err)
Runtime.FatalError("Unable to open FileStream"); Runtime.FatalError("Unable to open FileStream");
let json = FromStream(stream); let json = FromStream(stream);

View File

@ -88,12 +88,6 @@ namespace Strawberry
{ {
if (scene != null) if (scene != null)
scene.Update(); 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;
}
} }
} }

View File

@ -16,6 +16,12 @@ namespace Strawberry
public Module Run() public Module Run()
{ {
Time.RawPreviousElapsed = 0;
Time.RawElapsed = 0;
Time.PreviousElapsed = 0;
Time.Elapsed = 0;
Time.Freeze = 0;
while (true) while (true)
{ {
let tick = PlatformLayer.Ticks; let tick = PlatformLayer.Ticks;
@ -41,6 +47,14 @@ namespace Strawberry
Input.AfterUpdate(); Input.AfterUpdate();
} }
//Update elapsed
{
Time.RawPreviousElapsed = Time.RawElapsed;
Time.RawElapsed += Time.RawDelta;
Time.PreviousElapsed = Time.Elapsed;
Time.Elapsed += Time.Delta;
}
// render // render
Render(); Render();
@ -58,6 +72,7 @@ namespace Strawberry
} }
} }
protected abstract void Started();
protected abstract void Update(); protected abstract void Update();
protected abstract void Render(); protected abstract void Render();

View File

@ -194,8 +194,8 @@ namespace Strawberry.SDL2
public override void GameRenderEnd() public override void GameRenderEnd()
{ {
GL.glUseProgram(0);
GL.glFlush(); GL.glFlush();
GL.glUseProgram(0);
} }
public override void RenderEnd() public override void RenderEnd()

View File

@ -8,6 +8,7 @@ namespace Strawberry
Startup(); Startup();
Module current = module; Module current = module;
current.[Friend]Started();
while (true) while (true)
{ {
let newModule = current.Run(); let newModule = current.Run();
@ -16,6 +17,7 @@ namespace Strawberry
{ {
delete current; delete current;
current = newModule; current = newModule;
current.[Friend]Started();
} }
else else
{ {