AddEntityRenderer and AddGeneralRenderer take initialized renderers
parent
29179e0ad6
commit
148d629e51
|
@ -97,9 +97,8 @@ namespace Encompass
|
|||
return engine;
|
||||
}
|
||||
|
||||
public TRenderer AddEntityRenderer<TRenderer>() where TRenderer : Renderer, new()
|
||||
public TRenderer AddEntityRenderer<TRenderer>(TRenderer renderer) where TRenderer : Renderer
|
||||
{
|
||||
var renderer = new TRenderer();
|
||||
renderer.AssignEntityManager(entityManager);
|
||||
renderer.AssignComponentManager(componentManager);
|
||||
|
||||
|
@ -112,9 +111,8 @@ namespace Encompass
|
|||
return renderer;
|
||||
}
|
||||
|
||||
public TRenderer AddGeneralRenderer<TRenderer>(int layer) where TRenderer : GeneralRenderer, new()
|
||||
public TRenderer AddGeneralRenderer<TRenderer>(TRenderer renderer, int layer) where TRenderer : GeneralRenderer
|
||||
{
|
||||
var renderer = new TRenderer();
|
||||
renderer.AssignEntityManager(entityManager);
|
||||
renderer.AssignComponentManager(componentManager);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Encompass
|
||||
namespace Encompass.Exceptions
|
||||
{
|
||||
public class ComponentTypeMismatchException : Exception
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Tests
|
|||
public void CheckAndTrackEntities()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
var renderer = worldBuilder.AddEntityRenderer<TestRenderer>();
|
||||
var renderer = worldBuilder.AddEntityRenderer(new TestRenderer());
|
||||
|
||||
AComponent aComponent;
|
||||
BComponent bComponent;
|
||||
|
@ -68,7 +68,7 @@ namespace Tests
|
|||
public void InactiveDrawComponent()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
var renderer = worldBuilder.AddEntityRenderer<TestRenderer>();
|
||||
var renderer = worldBuilder.AddEntityRenderer(new TestRenderer());
|
||||
|
||||
AComponent aComponent;
|
||||
BComponent bComponent;
|
||||
|
@ -110,7 +110,7 @@ namespace Tests
|
|||
public void RenderMethodCalledOnWorldDraw()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
var renderer = worldBuilder.AddEntityRenderer<CalledRenderer>();
|
||||
var renderer = worldBuilder.AddEntityRenderer(new CalledRenderer());
|
||||
|
||||
AComponent aComponent;
|
||||
CComponent cComponent;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Tests
|
|||
public void SingletonComponent()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
worldBuilder.AddGeneralRenderer<TestRenderer>(1);
|
||||
worldBuilder.AddGeneralRenderer(new TestRenderer(), 1);
|
||||
|
||||
AComponent aComponent;
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace Tests
|
|||
public void MultipleComponents()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
worldBuilder.AddGeneralRenderer<TestRenderer>(1);
|
||||
worldBuilder.AddGeneralRenderer(new TestRenderer(), 1);
|
||||
|
||||
AComponent aComponent;
|
||||
AComponent aComponentTwo;
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace Tests
|
|||
public void DrawOrder()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
worldBuilder.AddEntityRenderer<TestEntityRenderer>();
|
||||
var testGeneralRenderer = worldBuilder.AddGeneralRenderer<TestGeneralRenderer>(7);
|
||||
worldBuilder.AddEntityRenderer(new TestEntityRenderer());
|
||||
var testGeneralRenderer = worldBuilder.AddGeneralRenderer(new TestGeneralRenderer(), 7);
|
||||
|
||||
TestComponent testComponent;
|
||||
TestDrawComponent testDrawComponent = default(TestDrawComponent);
|
||||
|
|
Loading…
Reference in New Issue