Converts to and from Relative space. https://deltaengine.fogbugz.com/default.asp?W101
View code on GitHub
Inheritance Hierarchy
DeltaEngine.ScreenSpaces ScreenSpace
DeltaEngine.ScreenSpaces RelativeScreenSpace
Namespace: DeltaEngine.ScreenSpaces
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The RelativeScreenSpace type exposes the following members.
Constructors
Name | Description | |
---|---|---|
RelativeScreenSpace | Initializes a new instance of the RelativeScreenSpace class |
Methods
Name | Description | |
---|---|---|
Dispose | (Inherited from ScreenSpace.) | |
FromPixelSpace(Rectangle) | (Inherited from ScreenSpace.) | |
FromPixelSpace(Size) | (Overrides ScreenSpace FromPixelSpace(Size).) | |
FromPixelSpace(Vector2D) | (Overrides ScreenSpace FromPixelSpace(Vector2D).) | |
GetInnerPosition | (Overrides ScreenSpace GetInnerPosition(Vector2D).) | |
RaiseViewportSizeChanged | (Inherited from ScreenSpace.) | |
ToPixelSpace(Rectangle) | (Inherited from ScreenSpace.) | |
ToPixelSpace(Size) | (Overrides ScreenSpace ToPixelSpace(Size).) | |
ToPixelSpace(Vector2D) | (Overrides ScreenSpace ToPixelSpace(Vector2D).) | |
ToPixelSpaceRounded |
The rounded version of ToPixelSpace is used for lines, boxes and fonts where it matters to
actually render at exact pixel positions to get sharp lines, boxes or font rendering.
View code on GitHub (Inherited from ScreenSpace.) | |
Update | (Overrides ScreenSpace Update(Size).) |
Fields
Name | Description | |
---|---|---|
viewportPixelSize | (Inherited from ScreenSpace.) |
Properties
Name | Description | |
---|---|---|
AspectRatio | (Inherited from ScreenSpace.) | |
Bottom | (Overrides ScreenSpace Bottom.) | |
BottomRight | (Overrides ScreenSpace BottomRight.) | |
Left | (Overrides ScreenSpace Left.) | |
Right | (Overrides ScreenSpace Right.) | |
Top | (Overrides ScreenSpace Top.) | |
TopLeft | (Overrides ScreenSpace TopLeft.) | |
Viewport | (Inherited from ScreenSpace.) |
Events
Name | Description | |
---|---|---|
ViewportSizeChanged | (Inherited from ScreenSpace.) |
Remarks
Examples
[Test] public void SquareWindowWithRelativeSpace() { SquareWindowShouldAlwaysReturnRelativeValues(new RelativeScreenSpace(window)); }
[Test] 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)); }
[Test] 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))); }
See Also