Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.Datatypes.RectangleTests
3 unit tests call DeltaEngine.Datatypes.Rectangle.Center
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: Vector2DRemarks
Examples
[Test] public void GetCenter() { var rect = new Rectangle(4, 4, 4, 4); Assert.AreEqual(new Vector2D(4, 4), rect.TopLeft); Assert.AreEqual(new Vector2D(8, 8), rect.BottomRight); Assert.AreEqual(new Vector2D(6, 6), rect.Center); }
[Test] public void SetCenter() { var rect = new Rectangle(8, 10, 2, 2) { Center = Vector2D.One }; Assert.AreEqual(new Vector2D(0, 0), rect.TopLeft); Assert.AreEqual(new Vector2D(2, 2), rect.BottomRight); Assert.AreEqual(new Vector2D(1, 1), rect.Center); }
[Test] public void FromCenter() { Rectangle rect = Rectangle.FromCenter(new Vector2D(11, 12), new Size(4, 6)); Assert.AreEqual(new Rectangle(9, 9, 4, 6), rect); Rectangle anotherRect = Rectangle.FromCenter(0.5f, 0.5f, 1.0f, 1.0f); Assert.AreEqual(new Rectangle(0, 0, 1, 1), anotherRect); }
See Also