ordered renderer now requires IDrawComponent interface

pull/5/head
Evan Hemsley 2019-09-26 12:29:59 -07:00
parent 5429783633
commit ddbfd492d3
5 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1,4 @@
namespace Encompass
{
public interface IDrawComponent { }
}

View File

@ -2,7 +2,7 @@
namespace Encompass
{
public abstract class OrderedRenderer<TComponent> : Renderer where TComponent : struct, IComponent
public abstract class OrderedRenderer<TComponent> : Renderer where TComponent : struct, IComponent, IDrawComponent
{
public abstract void Render(Guid drawComponentID, TComponent drawComponent);

View File

@ -144,7 +144,7 @@ namespace Encompass
return engine;
}
public OrderedRenderer<TComponent> AddOrderedRenderer<TComponent>(OrderedRenderer<TComponent> renderer) where TComponent : struct, IComponent
public OrderedRenderer<TComponent> AddOrderedRenderer<TComponent>(OrderedRenderer<TComponent> renderer) where TComponent : struct, IComponent, IDrawComponent
{
renderer.AssignEntityManager(entityManager);
renderer.AssignComponentManager(componentManager);

View File

@ -13,7 +13,7 @@ namespace Tests
struct BComponent : IComponent { }
struct CComponent : IComponent { }
struct TestDrawComponent : IComponent { }
struct TestDrawComponent : IComponent, IDrawComponent { }
class TestRenderer : OrderedRenderer<TestDrawComponent>
{

View File

@ -12,7 +12,7 @@ namespace Tests
public class WorldTest
{
struct TestComponent : IComponent { }
struct TestDrawComponent : IComponent { }
struct TestDrawComponent : IComponent, IDrawComponent { }
static List<object> drawOrder = new List<object>();