Behaves like QuadraticScreenSpace but can also pan and zoom.
See https://deltaengine.fogbugz.com/default.asp?W101
View code on GitHub
Inheritance Hierarchy
DeltaEngine.ScreenSpaces ScreenSpace
DeltaEngine.ScreenSpaces QuadraticScreenSpace
DeltaEngine.ScreenSpaces Camera2DScreenSpace
Namespace: DeltaEngine.ScreenSpaces
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Camera2DScreenSpace type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Camera2DScreenSpace | Initializes a new instance of the Camera2DScreenSpace class |
Methods
Name | Description | |
---|---|---|
Dispose | (Inherited from ScreenSpace.) | |
FromPixelSpace(Rectangle) | (Inherited from ScreenSpace.) | |
FromPixelSpace(Size) | (Overrides QuadraticScreenSpace FromPixelSpace(Size).) | |
FromPixelSpace(Vector2D) | (Overrides QuadraticScreenSpace FromPixelSpace(Vector2D).) | |
GetInnerPosition | (Inherited from QuadraticScreenSpace.) | |
InverseTransform | ||
RaiseViewportSizeChanged | (Inherited from ScreenSpace.) | |
ToPixelSpace(Rectangle) | (Inherited from ScreenSpace.) | |
ToPixelSpace(Size) | (Overrides QuadraticScreenSpace ToPixelSpace(Size).) | |
ToPixelSpace(Vector2D) | (Overrides QuadraticScreenSpace 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.) | |
Transform | ||
Update | (Inherited from QuadraticScreenSpace.) |
Fields
Name | Description | |
---|---|---|
LookAt | ||
Rotation | ||
RotationCenter | ||
viewportPixelSize | (Inherited from ScreenSpace.) |
Properties
Name | Description | |
---|---|---|
AspectRatio | (Inherited from ScreenSpace.) | |
Bottom | (Overrides QuadraticScreenSpace Bottom.) | |
BottomRight | (Overrides QuadraticScreenSpace BottomRight.) | |
Left | (Overrides QuadraticScreenSpace Left.) | |
Right | (Overrides QuadraticScreenSpace Right.) | |
Top | (Overrides QuadraticScreenSpace Top.) | |
TopLeft | (Overrides QuadraticScreenSpace TopLeft.) | |
Viewport | (Inherited from ScreenSpace.) | |
Zoom |
Events
Name | Description | |
---|---|---|
ViewportSizeChanged | (Inherited from ScreenSpace.) |
Remarks
Examples
[Test] public void LookAt() { var camera = new Camera2DScreenSpace(window); Assert.AreEqual(Vector2D.Half, camera.LookAt); camera.LookAt = Vector2D.One; Assert.AreEqual(Vector2D.One, camera.LookAt); }
[Test] public void Zoom() { var camera = new Camera2DScreenSpace(window); Assert.AreEqual(1.0f, camera.Zoom); camera.Zoom = 2.5f; Assert.AreEqual(2.5f, camera.Zoom); }
[Test] 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)))); }
See Also