passing draw components by ref
continuous-integration/drone/push Build is passing Details

pull/3/head
Evan Hemsley 2020-03-20 14:13:26 -07:00
parent b6ae9eaebc
commit 6d699e4b17
5 changed files with 8 additions and 7 deletions

View File

@ -105,7 +105,7 @@ namespace Encompass
var queryWithAttribute = GetType().GetCustomAttribute<QueryWith>(false); var queryWithAttribute = GetType().GetCustomAttribute<QueryWith>(false);
if (queryWithAttribute != null) if (queryWithAttribute != null)
{ {
QueryWithTypes = queryWithAttribute.QueryWithTypes.ToHashSet(); QueryWithTypes = queryWithAttribute.QueryWithTypes;
} }
var queryWithoutAttribute = GetType().GetCustomAttribute<QueryWithout>(false); var queryWithoutAttribute = GetType().GetCustomAttribute<QueryWithout>(false);

View File

@ -7,7 +7,7 @@ namespace Encompass
/// </summary> /// </summary>
public abstract class OrderedRenderer<TComponent> : Renderer where TComponent : struct, IComponent, IDrawableComponent public abstract class OrderedRenderer<TComponent> : Renderer where TComponent : struct, IComponent, IDrawableComponent
{ {
public abstract void Render(Entity entity, TComponent drawComponent); public abstract void Render(Entity entity, in TComponent drawComponent);
internal void InternalRender(Entity entity) internal void InternalRender(Entity entity)
{ {

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8.0</LangVersion> <LangVersion>8.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Encompass</RootNamespace> <RootNamespace>Encompass</RootNamespace>
@ -28,5 +28,6 @@
<PackageReference Include="MoonTools.Core.Graph" Version="1.0.0" /> <PackageReference Include="MoonTools.Core.Graph" Version="1.0.0" />
<PackageReference Include="MoonTools.FastCollections" Version="1.0.0" /> <PackageReference Include="MoonTools.FastCollections" Version="1.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.7.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.7.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -20,13 +20,13 @@ namespace Tests
class TestRenderer : OrderedRenderer<TestDrawComponent> class TestRenderer : OrderedRenderer<TestDrawComponent>
{ {
public override void Render(Entity entity, TestDrawComponent testDrawComponent) { } public override void Render(Entity entity, in TestDrawComponent testDrawComponent) { }
} }
static bool called = false; static bool called = false;
class DeactivatedRenderer : TestRenderer class DeactivatedRenderer : TestRenderer
{ {
public override void Render(Entity entity, TestDrawComponent testDrawComponent) public override void Render(Entity entity, in TestDrawComponent testDrawComponent)
{ {
called = true; called = true;
} }
@ -37,7 +37,7 @@ namespace Tests
class CalledRenderer : OrderedRenderer<TestDrawComponent> class CalledRenderer : OrderedRenderer<TestDrawComponent>
{ {
public override void Render(Entity entity, TestDrawComponent testDrawComponent) public override void Render(Entity entity, in TestDrawComponent testDrawComponent)
{ {
resultComponent = (testDrawComponent, entity); resultComponent = (testDrawComponent, entity);
calledOnDraw = true; calledOnDraw = true;

View File

@ -21,7 +21,7 @@ namespace Tests
class TestEntityRenderer : OrderedRenderer<TestDrawComponent> class TestEntityRenderer : OrderedRenderer<TestDrawComponent>
{ {
public override void Render(Entity entity, TestDrawComponent testDrawComponent) public override void Render(Entity entity, in TestDrawComponent testDrawComponent)
{ {
drawOrder.Add(entity); drawOrder.Add(entity);
} }