Namespace: DeltaEngine.ScreenSpaces
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.ScreenSpaces.Camera2DScreenSpaceTests
3 unit tests call DeltaEngine.ScreenSpaces.Camera2DScreenSpace.TopLeft
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: Vector2DRemarks
Examples
[Test] public void IfCameraNotAdjustedEdgesAreIdenticalToQuadraticScreenSpace() { var q = new QuadraticScreenSpace(window); var c = new Camera2DScreenSpace(window); Assert.AreEqual(q.TopLeft, c.TopLeft); Assert.AreEqual(q.BottomRight, c.BottomRight); Assert.AreEqual(q.Top, c.Top, 0.0001f); Assert.AreEqual(q.Left, c.Left, 0.0001f); Assert.AreEqual(q.Bottom, c.Bottom, 0.0001f); Assert.AreEqual(q.Right, c.Right, 0.0001f); }
[Test] public void EdgesAfterZoomingIn() { Assert.AreEqual(16 / 9.0f, window.ViewportPixelSize.AspectRatio); var camera = new Camera2DScreenSpace(window) { Zoom = 2.0f }; Assert.AreEqual(new Vector2D(0.25f, 0.359375f), camera.TopLeft); Assert.AreEqual(new Vector2D(0.75f, 0.640625f), camera.BottomRight); Assert.AreEqual(0.359375f, camera.Top, 0.0001f); Assert.AreEqual(0.25f, camera.Left, 0.0001f); Assert.AreEqual(0.640625f, camera.Bottom, 0.0001f); Assert.AreEqual(0.75f, camera.Right, 0.0001f); }
[Test] public void EdgesAfterPanningAndZooming() { Assert.AreEqual(16 / 9.0f, window.ViewportPixelSize.AspectRatio); var camera = new Camera2DScreenSpace(window) { LookAt = new Vector2D(0.4f, 0.5f), Zoom = 0.5f }; Assert.AreEqual(new Vector2D(-0.6f, -0.0625f), camera.TopLeft); Assert.AreEqual(new Vector2D(1.4f, 1.0625f), camera.BottomRight); Assert.AreEqual(-0.0625f, camera.Top, 0.0001f); Assert.AreEqual(-0.6f, camera.Left, 0.0001f); Assert.AreEqual(1.0625f, camera.Bottom, 0.0001f); Assert.AreEqual(1.4f, camera.Right, 0.0001f); }
See Also