Namespace: DeltaEngine.ScreenSpaces
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.ScreenSpaces.PixelScreenSpaceTests
3 unit tests call DeltaEngine.ScreenSpaces.PixelScreenSpace.FromPixelSpace(DeltaEngine.Datatypes.Size)
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- pixelSize
- Type: DeltaEngine.Datatypes Size
Return Value
Type: SizeRemarks
Examples
[Test] public void SquareWindowWithPixelSpace() { var screen = new PixelScreenSpace(window); Assert.AreEqual(Vector2D.Zero, screen.TopLeft); Assert.AreEqual(window.ViewportPixelSize, (Size)screen.BottomRight); Assert.AreEqual(new Rectangle(Vector2D.Zero, window.TotalPixelSize), screen.Viewport); Assert.AreEqual(new Vector2D(100, 100), screen.FromPixelSpace(new Vector2D(100, 100))); Assert.AreEqual(new Rectangle(10, 10, 80, 80), screen.FromPixelSpace(new Rectangle(10, 10, 80, 80))); window.CloseAfterFrame(); }
[Test] public void ToPixelSpaceAndFromPixelSpace() { var pixelScreen = new PixelScreenSpace(window); Assert.AreEqual(pixelScreen.TopLeft, pixelScreen.ToPixelSpace(pixelScreen.TopLeft)); Assert.AreEqual(pixelScreen.BottomRight, pixelScreen.ToPixelSpace(pixelScreen.BottomRight)); Assert.AreEqual(Size.Zero, pixelScreen.ToPixelSpace(Size.Zero)); Assert.AreEqual(Size.One, pixelScreen.ToPixelSpace(Size.One)); window.CloseAfterFrame(); }
[Test] public void SquareWindow() { var pixelScreen = new PixelScreenSpace(window); window.ViewportPixelSize = new Size(100, 100); Assert.AreEqual(Vector2D.Zero, pixelScreen.TopLeft); Assert.AreEqual(new Vector2D(100, 100), pixelScreen.BottomRight); Assert.AreEqual(new Rectangle(0, 0, 100, 100), pixelScreen.Viewport); Assert.AreEqual(new Vector2D(100, 100), pixelScreen.FromPixelSpace(new Vector2D(100, 100))); Assert.AreEqual(new Vector2D(50, 50), pixelScreen.FromPixelSpace(new Vector2D(50, 50))); }
See Also