public void GetInnerPoint()
 {
     window.TotalPixelSize = new Size(800, 600);
     ScreenSpace screen = new RelativeScreenSpace(window);
     Assert.AreEqual(screen.TopLeft, screen.GetInnerPoint(Point.Zero));
     Assert.AreEqual(screen.BottomRight, screen.GetInnerPoint(Point.One));
 }
 public void ToRelativeWithUnevenSize()
 {
     window.TotalPixelSize = new Size(99, 199);
     var screen = new RelativeScreenSpace(window);
     Assert.AreEqual(Point.Zero, screen.TopLeft);
     Assert.AreEqual(Point.One, screen.BottomRight);
     Assert.AreEqual(screen.BottomRight, screen.FromPixelSpace(new Point(99, 199)));
 }
        public void GetInnerPoint()
        {
            window.ViewportPixelSize = new Size(800, 600);
            ScreenSpace screen = new RelativeScreenSpace(window);

            Assert.AreEqual(screen.TopLeft, screen.GetInnerPosition(Vector2D.Zero));
            Assert.AreEqual(screen.BottomRight, screen.GetInnerPosition(Vector2D.One));
        }
 public void ToPixelSpaceFromRelativeSpace()
 {
     window.TotalPixelSize = new Size(30, 50);
     var screen = new RelativeScreenSpace(window);
     Assert.AreEqual(new Point(30, 50), screen.ToPixelSpace(Point.One));
     Assert.AreEqual(Size.Zero, screen.ToPixelSpace(Size.Zero));
     Assert.AreEqual(new Point(10, 20), screen.ToPixelSpace(new Point(10 / 30.0f, 20 / 50.0f)));
     Assert.AreEqual(new Size(7.5f, 12.5f), screen.ToPixelSpace(new Size(0.25f)));
 }
 public void NonSquareWindowWithRelativeSpace()
 {
     window.TotalPixelSize = new Size(100, 75);
     var screen = new RelativeScreenSpace(window);
     Assert.AreEqual(0.0f, screen.Left);
     Assert.AreEqual(0.0f, screen.Top);
     Assert.AreEqual(1.0f, screen.Right);
     Assert.AreEqual(1.0f, screen.Bottom);
 }
        public void ToRelativeWithUnevenSize()
        {
            window.ViewportPixelSize = new Size(99, 199);
            var screen = new RelativeScreenSpace(window);

            Assert.AreEqual(Vector2D.Zero, screen.TopLeft);
            Assert.AreEqual(Vector2D.One, screen.BottomRight);
            Assert.AreEqual(screen.BottomRight, screen.FromPixelSpace(new Vector2D(99, 199)));
        }
        public void NonSquareWindowWithRelativeSpace()
        {
            window.ViewportPixelSize = new Size(100, 75);
            var screen = new RelativeScreenSpace(window);

            Assert.AreEqual(0.0f, screen.Left);
            Assert.AreEqual(0.0f, screen.Top);
            Assert.AreEqual(1.0f, screen.Right);
            Assert.AreEqual(1.0f, screen.Bottom);
        }
        public void ToPixelSpaceFromRelativeSpace()
        {
            window.ViewportPixelSize = new Size(30, 50);
            var screen = new RelativeScreenSpace(window);

            Assert.AreEqual(new Vector2D(30, 50), screen.ToPixelSpace(Vector2D.One));
            Assert.AreEqual(Size.Zero, screen.ToPixelSpace(Size.Zero));
            Assert.AreEqual(new Vector2D(10, 20), screen.ToPixelSpace(new Vector2D(10 / 30.0f, 20 / 50.0f)));
            Assert.AreEqual(new Size(7.5f, 12.5f), screen.ToPixelSpace(new Size(0.25f)));
        }