Rectangle Top Property Delta Engine Documentation

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

public float Top { get; set; }

Property Value

Type: Single
Remarks

Tests: DeltaEngine.Tests.Datatypes.RectangleTests
Examples

3 unit tests call DeltaEngine.Datatypes.Rectangle.Top
[Test]
public void ChangeValues()
{
    var rect = Rectangle.One;
    rect.Left = 2;
    rect.Top = 1;
    rect.Width = 2;
    rect.Height = 3;
    Assert.AreEqual(new Rectangle(2, 1, 2, 3), rect);
}
[Test]
public void TopRight()
{
    var rect = new Rectangle(1, 2, 10, 20);
    Assert.AreEqual(new Vector2D(11, 2), rect.TopRight);
}
[Test]
public void IsCollidingTopBottom()
{
    var topRect = new Rectangle(0.44f, 0.4f, 0.05f, 0.03f);
    var bottomRect = new Rectangle(0.44f, 0.44f, 0.04f, 0.03f);
    Assert.IsFalse(topRect.IsColliding(0, bottomRect, 0));
    Assert.IsFalse(bottomRect.IsColliding(0, topRect, 0));
}
See Also