Namespace: DeltaEngine.Tests.ScreenSpaces
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Examples
[Test] public void SquareWindowWithInvertedSpace() { window.ViewportPixelSize = new Size(100, 100); var screen = new InvertedScreenSpace(window); Assert.AreEqual(Vector2D.UnitY, screen.TopLeft); Assert.AreEqual(Vector2D.UnitX, screen.BottomRight); Assert.AreEqual(new Rectangle(Vector2D.UnitY, new Size(1, -1)), screen.Viewport); Assert.IsTrue(screen.FromPixelSpace(new Vector2D(100, 100)).IsNearlyEqual(Vector2D.UnitX)); Assert.IsTrue( screen.FromPixelSpace(new Rectangle(10, 10, 80, 80)).IsNearlyEqual(new Rectangle(0.1f, 0.9f, 0.8f, 0.8f))); }
[Test] public void NonSquareWindowWithInvertedSpace() { window.ViewportPixelSize = new Size(100, 75); var screen = new InvertedScreenSpace(window); Assert.AreEqual(0.0f, screen.Left); Assert.AreEqual(1.0f, screen.Top); Assert.AreEqual(1.0f, screen.Right); Assert.AreEqual(0.0f, screen.Bottom); }
See Also