Namespace: DeltaEngine.Rendering2D
Assembly: DeltaEngine.Rendering2D (in DeltaEngine.Rendering2D.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Rendering2D.Tests.HierarchyEntity2DTests
3 unit tests call DeltaEngine.Rendering2D.HierarchyEntity2D.RelativeRotation
Assembly: DeltaEngine.Rendering2D (in DeltaEngine.Rendering2D.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: SingleImplements
HierarchyObject2D RelativeRotationRemarks
Examples
[Test] public void SetLocalsUpdatesGlobals() { var parentEntity = new MockHierarchyEntity2D(Rectangle.FromCenter(Vector2D.Half, Size.Zero)); var childEntity = new MockHierarchyEntity2D(Rectangle.Zero); parentEntity.Add(childEntity); var childRelativePosition = new Vector2D(0.2f, 0.0f); childEntity.RelativePosition = childRelativePosition; childEntity.RelativeRotation = 10; Assert.AreEqual(parentEntity.Center + childRelativePosition, childEntity.Center); Assert.AreEqual(10, childEntity.Rotation); }
[Test] public void BuildHierarchyOfDifferentEntities() { var parentEntity = new MockHierarchyEntity2D(); var entityGivenPosition = new MockHierarchyEntity2D(new Vector2D(0.3f, 0.4f)); var entityGivenRect = new MockHierarchyEntity2D(new Rectangle(0.1f, 0.0f, 0.5f, 0.4f), 20); parentEntity.Add(entityGivenPosition); parentEntity.Add(entityGivenRect); Assert.AreEqual(parentEntity, entityGivenPosition.Parent); Assert.AreEqual(new Vector2D(0.3f, 0.4f), entityGivenPosition.RelativePosition); Assert.AreEqual(parentEntity, entityGivenRect.Parent); Assert.AreEqual(20, entityGivenRect.RelativeRotation); }
[Test] public void SettingLocalWithoutParentSetsGlobal() { var entity = new MockHierarchyEntity2D(); var setPosition = new Vector2D(0.2f,0.5f); const float SetRotation = 30.0f; entity.RelativePosition = setPosition; entity.RelativeRotation = SetRotation; Assert.AreEqual(setPosition, entity.Center); Assert.AreEqual(SetRotation, entity.Rotation); }
See Also