Rectangle TopLeft Property Delta Engine Documentation

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

public Vector2D TopLeft { get; }

Property Value

Type: Vector2D
Remarks

Tests: DeltaEngine.Tests.Datatypes.RectangleTests
Examples

5 unit tests call DeltaEngine.Datatypes.Rectangle.TopLeft
[Test]
public void Create()
{
    var point = new Vector2D(2f, 2f);
    var size = new Size(1f, 1f);
    var rect = new Rectangle(point, size);
    Assert.AreEqual(point.X, rect.Left);
    Assert.AreEqual(point.Y, rect.Top);
    Assert.AreEqual(size.Width, rect.Width);
    Assert.AreEqual(size.Height, rect.Height);
    Assert.AreEqual(point, rect.TopLeft);
    Assert.AreEqual(size, rect.Size);
}
[Test]
public void CreateFromFivePoints()
{
    var points = new List<Vector2D> { Vector2D.Zero, Vector2D.One, Vector2D.One * 1.5f, 
        Vector2D.Half, -Vector2D.One };
    var rectangle = Rectangle.FromPoints(points);
    Assert.AreEqual(-Vector2D.One, rectangle.TopLeft);
    Assert.AreEqual(Vector2D.One * 1.5f, rectangle.BottomRight);
}
[Test]
public void CreateFromTwoPoints()
{
    var points = new List<Vector2D> { new Vector2D(4, 4), new Vector2D(3, 2) };
    var rectangle = Rectangle.FromPoints(points);
    Assert.AreEqual(new Vector2D(3, 2), rectangle.TopLeft);
    Assert.AreEqual(new Vector2D(4, 4), rectangle.BottomRight);
}
See Also