C# Class Nez.Camera

Inheritance: Component
Mostrar archivo Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
farClipPlane3D float
nearClipPlane3D float
positionZ3D float

Public Methods

Method Description
Camera ( ) : System
forceMatrixUpdate ( ) : void

this forces the matrix and bounds dirty

onEntityTransformChanged ( Transform comp ) : void
screenToWorldPoint ( Point screenPosition ) : Vector2

converts a point from screen coordinates to world

screenToWorldPoint ( Vector2 screenPosition ) : Vector2

converts a point from screen coordinates to world

setMaximumZoom ( float maxZoom ) : Camera

maximum non-scaled value (0 - float.Max) that the camera zoom can be. Defaults to 3

setMinimumZoom ( float minZoom ) : Camera

minimum non-scaled value (0 - float.Max) that the camera zoom can be. Defaults to 0.3

setPosition ( Vector2 position ) : Camera

shortcut to entity.transform.setPosition

setRotation ( float radians ) : Camera

shortcut to entity.transform.setRotation

setRotationDegrees ( float degrees ) : Camera

shortcut to entity.transform.setRotationDegrees

setZoom ( float zoom ) : Camera

sets the the zoom value which should be between -1 and 1. This value is then translated to be from minimumZoom to maximumZoom. This lets you set appropriate minimum/maximum values then use a more intuitive -1 to 1 mapping to change the zoom.

worldToScreenPoint ( Vector2 worldPosition ) : Vector2

converts a point from world coordinates to screen

zoomIn ( float deltaZoom ) : void
zoomOut ( float deltaZoom ) : void

Protected Methods

Method Description
updateMatrixes ( ) : void

Private Methods

Method Description
onSceneRenderTargetSizeChanged ( int newWidth, int newHeight ) : void

when the scene render target size changes we update the cameras origin and adjust the position to keep it where it was

Method Details

Camera() public method

public Camera ( ) : System
return System

forceMatrixUpdate() public method

this forces the matrix and bounds dirty
public forceMatrixUpdate ( ) : void
return void

onEntityTransformChanged() public method

public onEntityTransformChanged ( Transform comp ) : void
comp Transform
return void

screenToWorldPoint() public method

converts a point from screen coordinates to world
public screenToWorldPoint ( Point screenPosition ) : Vector2
screenPosition Point Screen position.
return Vector2

screenToWorldPoint() public method

converts a point from screen coordinates to world
public screenToWorldPoint ( Vector2 screenPosition ) : Vector2
screenPosition Vector2 Screen position.
return Vector2

setMaximumZoom() public method

maximum non-scaled value (0 - float.Max) that the camera zoom can be. Defaults to 3
public setMaximumZoom ( float maxZoom ) : Camera
maxZoom float Max zoom.
return Camera

setMinimumZoom() public method

minimum non-scaled value (0 - float.Max) that the camera zoom can be. Defaults to 0.3
public setMinimumZoom ( float minZoom ) : Camera
minZoom float
return Camera

setPosition() public method

shortcut to entity.transform.setPosition
public setPosition ( Vector2 position ) : Camera
position Vector2
return Camera

setRotation() public method

shortcut to entity.transform.setRotation
public setRotation ( float radians ) : Camera
radians float Radians.
return Camera

setRotationDegrees() public method

shortcut to entity.transform.setRotationDegrees
public setRotationDegrees ( float degrees ) : Camera
degrees float Degrees.
return Camera

setZoom() public method

sets the the zoom value which should be between -1 and 1. This value is then translated to be from minimumZoom to maximumZoom. This lets you set appropriate minimum/maximum values then use a more intuitive -1 to 1 mapping to change the zoom.
public setZoom ( float zoom ) : Camera
zoom float Zoom.
return Camera

updateMatrixes() protected method

protected updateMatrixes ( ) : void
return void

worldToScreenPoint() public method

converts a point from world coordinates to screen
public worldToScreenPoint ( Vector2 worldPosition ) : Vector2
worldPosition Vector2 World position.
return Vector2

zoomIn() public method

public zoomIn ( float deltaZoom ) : void
deltaZoom float
return void

zoomOut() public method

public zoomOut ( float deltaZoom ) : void
deltaZoom float
return void

Property Details

farClipPlane3D public_oe property

far clip plane of the 3D camera projection
public float farClipPlane3D
return float

nearClipPlane3D public_oe property

near clip plane of the 3D camera projection
public float nearClipPlane3D
return float

positionZ3D public_oe property

z-position of the 3D camera projections. Affects the fov greatly. Lower values make the objects appear very long in the z-direction.
public float positionZ3D
return float