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