Compare commits

..

3 Commits

Author SHA1 Message Date
cosmonaut 00614661ec fix broken test
continuous-integration/drone/push Build is passing Details
2021-03-23 17:50:05 -07:00
cosmonaut 36e98b0376 add dt and alpha params to renderers
continuous-integration/drone/push Build is failing Details
2021-03-23 17:37:47 -07:00
cosmonaut 6858ec1b0f Mega Refactor (#20)
continuous-integration/drone/push Build is passing Details
Co-Authored-By: cosmonaut <evan@moonside.games>
Co-Committed-By: cosmonaut <evan@moonside.games>
2021-03-12 08:25:25 +00:00
6 changed files with 12 additions and 12 deletions

View File

@ -17,11 +17,11 @@ namespace Encompass
renderers.Add(renderer); renderers.Add(renderer);
} }
public void Draw() public void Draw(double dt, double alpha)
{ {
foreach (var renderer in renderers) foreach (var renderer in renderers)
{ {
renderer.Render(); renderer.Render(dt, alpha);
} }
} }
} }

View File

@ -18,7 +18,7 @@ namespace Encompass
_componentManager = componentManager; _componentManager = componentManager;
} }
public abstract void Render(); public abstract void Render(double dt, double alpha);
protected ReadOnlySpan<Entity> ReadEntities<TComponent>() where TComponent : struct protected ReadOnlySpan<Entity> ReadEntities<TComponent>() where TComponent : struct
{ {

View File

@ -20,7 +20,7 @@ namespace Encompass
} }
// can't reflect invoke on Span returns... // can't reflect invoke on Span returns...
public override void Render() public override void Render(double dt, double alpha)
{ {
foreach (var type in _componentTypes) foreach (var type in _componentTypes)
{ {

View File

@ -69,9 +69,9 @@ namespace Encompass
/// <summary> /// <summary>
/// Causes the Renderers to draw. /// Causes the Renderers to draw.
/// </summary> /// </summary>
public void Draw() public void Draw(double dt, double alpha)
{ {
_renderManager.Draw(); _renderManager.Draw(dt, alpha);
} }
} }
} }

View File

@ -474,7 +474,7 @@ namespace Encompass
dummyComponentManager.WriteComponents(); dummyComponentManager.WriteComponents();
uberRenderer.SetEntity(uberEngine.Entity); uberRenderer.SetEntity(uberEngine.Entity);
uberRenderer.Render(); uberRenderer.Render(1, 0);
} }
} }
} }

View File

@ -13,7 +13,7 @@ namespace Tests
class TestRenderer : Renderer class TestRenderer : Renderer
{ {
public override void Render() public override void Render(double dt, double alpha)
{ {
ref readonly var entity = ref ReadEntity<AComponent>(); ref readonly var entity = ref ReadEntity<AComponent>();
result = (GetComponent<AComponent>(entity), entity); result = (GetComponent<AComponent>(entity), entity);
@ -34,10 +34,10 @@ namespace Tests
var world = worldBuilder.Build(); var world = worldBuilder.Build();
world.Update(0.01f); world.Update(0.01f);
world.Draw(); world.Draw(0.01f, 0);
world.Update(0.01); world.Update(0.01);
world.Draw(); world.Draw(0.01f, 0);
Assert.That(result, Is.EqualTo((aComponent, entity))); Assert.That(result, Is.EqualTo((aComponent, entity)));
} }
@ -59,10 +59,10 @@ namespace Tests
var world = worldBuilder.Build(); var world = worldBuilder.Build();
world.Update(0.01f); world.Update(0.01f);
world.Draw(); world.Draw(0.01f, 0);
world.Update(0.01f); world.Update(0.01f);
world.Draw(); world.Draw(0.01f, 0);
Assert.That(result, Is.EqualTo((aComponent, entity)).Or.EqualTo((aComponentTwo, entityB))); Assert.That(result, Is.EqualTo((aComponent, entity)).Or.EqualTo((aComponentTwo, entityB)));
} }