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);
if (queryWithAttribute != null)
{
QueryWithTypes = queryWithAttribute.QueryWithTypes.ToHashSet();
QueryWithTypes = queryWithAttribute.QueryWithTypes;
}
var queryWithoutAttribute = GetType().GetCustomAttribute<QueryWithout>(false);

View File

@ -7,7 +7,7 @@ namespace Encompass
/// </summary>
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)
{

View File

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

View File

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

View File

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