public void ToPixelWithSquareWindow()
		{
			window.ViewportPixelSize = new Size(100, 100);
			var screen = new QuadraticScreenSpace(window);
			Assert.AreEqual(new Vector2D(100, 100), screen.ToPixelSpace(Vector2D.One));
			Assert.AreEqual(Vector2D.Zero, screen.ToPixelSpace(Vector2D.Zero));
			Assert.AreEqual(new Vector2D(50, 50), screen.ToPixelSpace(Vector2D.Half));
		}
		public void ToPixelWithUnevenSizeFromQuadraticSpace()
		{
			window.ViewportPixelSize = new Size(99, 199);
			var screen = new QuadraticScreenSpace(window);
			Assert.AreEqual(new Vector2D(149, 199), screen.ToPixelSpace(Vector2D.One));
			Assert.AreEqual(new Vector2D(-50, 0), screen.ToPixelSpace(Vector2D.Zero));
			Assert.AreEqual(new Vector2D(49.5f, 99.5f), screen.ToPixelSpace(Vector2D.Half));
			Assert.AreEqual(new Vector2D(50, 100), screen.ToPixelSpaceRounded(Vector2D.Half));
			Assert.AreEqual(new Vector2D(199, 199),
				screen.ToPixelSpaceRounded(Vector2D.One) - screen.ToPixelSpaceRounded(Vector2D.Zero));
		}
		public void IfCameraNotAdjustedItBehavesIdenticallyToQuadraticScreenSpace()
		{
			var q = new QuadraticScreenSpace(window);
			var c = new Camera2DScreenSpace(window);
			Assert.IsTrue(
				c.FromPixelSpace(new Vector2D(1, 2)).IsNearlyEqual(q.FromPixelSpace(new Vector2D(1, 2))));
			Assert.IsTrue(
				c.FromPixelSpace(new Size(-3, 4)).IsNearlyEqual(q.FromPixelSpace(new Size(-3, 4))));
			Assert.IsTrue(
				c.ToPixelSpace(new Vector2D(2, 6)).IsNearlyEqual(q.ToPixelSpace(new Vector2D(2, 6))));
			Assert.IsTrue(c.ToPixelSpace(new Size(-2, 0)).IsNearlyEqual(q.ToPixelSpace(new Size(-2, 0))));
		}
 public void ToPixelInFullHdResolution()
 {
     window.ViewportPixelSize = new Size(1920, 1080);
     var screen = new QuadraticScreenSpace(window);
     Assert.AreEqual(new Vector2D(1680, 1500), screen.ToPixelSpace(new Vector2D(0.875f, 1f)));
     var somePoint = screen.FromPixelSpace(new Vector2D(324, 483));
     var somePointPlusOne = screen.FromPixelSpace(new Vector2D(325, 483));
     Assert.IsFalse(somePoint.X.IsNearlyEqual(somePointPlusOne.X),
         somePoint + " should not be nearly equal to " + somePointPlusOne);
     Assert.AreEqual(new Vector2D(324, 483), screen.ToPixelSpaceRounded(somePoint));
     Assert.AreEqual(new Vector2D(325, 483), screen.ToPixelSpaceRounded(somePointPlusOne));
 }
 public void ToPixelWithPortraitWindow()
 {
     window.ViewportPixelSize = new Size(75, 100);
     var screen = new QuadraticScreenSpace(window);
     Assert.AreEqual(new Vector2D(75, 100), screen.ToPixelSpace(new Vector2D(0.875f, 1f)));
     Assert.AreEqual(Vector2D.Zero, screen.ToPixelSpace(new Vector2D(0.125f, 0)));
     Assert.AreEqual(new Vector2D(37.5f, 50), screen.ToPixelSpace(Vector2D.Half));
     Assert.AreEqual(new Size(10, 20), screen.ToPixelSpace(new Size(0.1f, 0.2f)));
 }
 public void ToPixelWithNonSquareWindow()
 {
     window.ViewportPixelSize = new Size(100, 75);
     var screen = new QuadraticScreenSpace(window);
     Assert.AreEqual(new Vector2D(100, 75), screen.ToPixelSpace(new Vector2D(1f, 0.875f)));
     Assert.AreEqual(Vector2D.Zero, screen.ToPixelSpace(new Vector2D(0, 0.125f)));
     Assert.AreEqual(new Vector2D(50, 37.5f), screen.ToPixelSpace(Vector2D.Half));
     Assert.AreEqual(new Size(10, 20), screen.ToPixelSpace(new Size(0.1f, 0.2f)));
     Assert.IsTrue(
         screen.ToPixelSpace(new Rectangle(0.2f, 0.2f, 0.6f, 0.6f)).IsNearlyEqual(new Rectangle(20,
             7.5f, 60, 60)));
 }