Entity2D RotatedDrawAreaContains Method Delta Engine Documentation

Namespace: DeltaEngine.Rendering2D
Assembly: DeltaEngine.Rendering2D (in DeltaEngine.Rendering2D.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public bool RotatedDrawAreaContains(
	Vector2D position
)

Return Value

Type: Boolean
Remarks

Tests: DeltaEngine.Rendering2D.Tests.Entity2DTests
Examples

3 unit tests call DeltaEngine.Rendering2D.Entity2D.RotatedDrawAreaContains(DeltaEngine.Datatypes.Vector2D)
[Test]
public void RotatedDrawAreaContainsWithNoRotation()
{
    var entity = new Entity2D(new Rectangle(0.4f, 0.4f, 0.2f, 0.1f));
    Assert.IsTrue(entity.RotatedDrawAreaContains(new Vector2D(0.45f, 0.45f)));
    Assert.IsTrue(entity.RotatedDrawAreaContains(new Vector2D(0.55f, 0.45f)));
    Assert.IsFalse(entity.RotatedDrawAreaContains(new Vector2D(0.55f, 0.55f)));
}
[Test]
public void RotatedDrawAreaContainsRotatedAroundItsCenter()
{
    var entity = new Entity2D(new Rectangle(0.4f, 0.4f, 0.2f, 0.1f)) { Rotation = 90 };
    Assert.IsTrue(entity.RotatedDrawAreaContains(new Rectangle(0.4f, 0.4f, 0.2f, 0.1f).Center));
    Assert.IsFalse(entity.RotatedDrawAreaContains(new Vector2D(0.4f, 0.4f)));
}
[Test]
public void RotatedDrawAreaContainsRotatedAroundTheScreenCenter()
{
    var entity = new Entity2D(new Rectangle(0.1f, 0.1f, 0.1f, 0.1f))
    {
        Rotation = 180,
        RotationCenter = Vector2D.Half
    };
    Assert.IsFalse(entity.RotatedDrawAreaContains(new Vector2D(0.15f, 0.15f)));
    Assert.IsTrue(entity.RotatedDrawAreaContains(new Vector2D(0.85f, 0.85f)));
    EntitiesRunner.Current.UpdateAndDrawAllEntities(() => {});
See Also