Maintains a screen resolution camera. Whole number increments seen through this camera represent one pixel. For example, setting an object to 300, 300 will position it at exactly that pixel position. More...

List of all members.

Public Member Functions

void UpdateCameraMatrix ()
 Updates the camera matrix to ensure 1:1 pixel mapping Or however the override is set up.

Static Public Member Functions

static tk2dCamera CameraForLayer (int layer)
 Returns the first camera in the list that can "see" this layer, or null if none can be found.

Public Attributes

tk2dCameraResolutionOverride[] resolutionOverride
 Resolution overrides, if necessary. See tk2dCameraResolutionOverride
int nativeResolutionWidth = 960
 Native resolution width of the camera. Override this in the inspector. Don't change this at runtime unless you understand the implications.
int nativeResolutionHeight = 640
 Native resolution height of the camera. Override this in the inspector. Don't change this at runtime unless you understand the implications.
bool viewportClippingEnabled = false
 Enable/disable viewport clipping. ScreenCamera must be valid for it to be actually enabled when rendering.
Vector4 viewportRegion = new Vector4(0, 0, 100, 100)
 Viewport clipping region.
bool forceResolutionInEditor = false
 Forces the resolution in the editor. This option is only used when tk2dCamera can't detect the game window resolution.
Vector2 forceResolution = new Vector2(960, 640)
 The resolution to force the game window to when forceResolutionInEditor is enabled.

Properties

tk2dCameraSettings CameraSettings [get]
 The unity camera settings. Use this instead of camera.XXX to change parameters.
tk2dCameraResolutionOverride CurrentResolutionOverride [get]
 The currently used override.
tk2dCamera InheritConfig [get, set]
 A tk2dCamera to inherit configuration from. All resolution and override settings will be pulled from the root inherited camera. This allows you to create a tk2dCamera prefab in your project or a master camera in the scene and guarantee that multiple instances of tk2dCameras referencing this will use exactly the same paramaters.
static tk2dCamera Instance [get]
 Global instance, used by sprite and textmesh class to quickly find the tk2dCamera instance.
Rect ScreenExtents [get]
 Returns screen extents - top, bottom, left and right will be the extent of the physical screen Regardless of resolution or override.
Rect NativeScreenExtents [get]
 Returns screen extents - top, bottom, left and right will be the extent of the native screen before it gets scaled and processed by overrides.
Vector2 TargetResolution [get]
 Target resolution The target resolution currently being used. If displaying on a 960x640 display, this will be the number returned here, regardless of scale, etc. If the editor resolution is forced, the returned value will be the forced resolution.
Vector2 NativeResolution [get]
 Native resolution The native resolution of this camera. This is the native resolution of the camera before any scaling is performed. The resolution the game is set up to run at initially.
float ZoomFactor [get, set]
 Zooms the current display A zoom factor of 2 will zoom in 2x, i.e. the object on screen will be twice as large Anchors will still be anchored, but will be scaled with the zoomScale. It is recommended to use a second camera for HUDs if necessary to avoid this behaviour.
float zoomScale [get, set]
 Obselete - use ZoomFactor instead.
Camera ScreenCamera [get]
 The camera that sees the screen - i.e. if viewport clipping is enabled, its the camera that sees the entire screen.

Detailed Description

Maintains a screen resolution camera. Whole number increments seen through this camera represent one pixel. For example, setting an object to 300, 300 will position it at exactly that pixel position.


Member Function Documentation

static tk2dCamera tk2dCamera.CameraForLayer ( int  layer) [static]

Returns the first camera in the list that can "see" this layer, or null if none can be found.

Updates the camera matrix to ensure 1:1 pixel mapping Or however the override is set up.


Member Data Documentation

Vector2 tk2dCamera.forceResolution = new Vector2(960, 640)

The resolution to force the game window to when forceResolutionInEditor is enabled.

Forces the resolution in the editor. This option is only used when tk2dCamera can't detect the game window resolution.

Native resolution height of the camera. Override this in the inspector. Don't change this at runtime unless you understand the implications.

Native resolution width of the camera. Override this in the inspector. Don't change this at runtime unless you understand the implications.

Enable/disable viewport clipping. ScreenCamera must be valid for it to be actually enabled when rendering.

Vector4 tk2dCamera.viewportRegion = new Vector4(0, 0, 100, 100)

Viewport clipping region.


Property Documentation

The unity camera settings. Use this instead of camera.XXX to change parameters.

A tk2dCamera to inherit configuration from. All resolution and override settings will be pulled from the root inherited camera. This allows you to create a tk2dCamera prefab in your project or a master camera in the scene and guarantee that multiple instances of tk2dCameras referencing this will use exactly the same paramaters.

Global instance, used by sprite and textmesh class to quickly find the tk2dCamera instance.

Native resolution The native resolution of this camera. This is the native resolution of the camera before any scaling is performed. The resolution the game is set up to run at initially.

Returns screen extents - top, bottom, left and right will be the extent of the native screen before it gets scaled and processed by overrides.

The camera that sees the screen - i.e. if viewport clipping is enabled, its the camera that sees the entire screen.

Returns screen extents - top, bottom, left and right will be the extent of the physical screen Regardless of resolution or override.

Target resolution The target resolution currently being used. If displaying on a 960x640 display, this will be the number returned here, regardless of scale, etc. If the editor resolution is forced, the returned value will be the forced resolution.

float tk2dCamera.ZoomFactor [get, set]

Zooms the current display A zoom factor of 2 will zoom in 2x, i.e. the object on screen will be twice as large Anchors will still be anchored, but will be scaled with the zoomScale. It is recommended to use a second camera for HUDs if necessary to avoid this behaviour.

float tk2dCamera.zoomScale [get, set]

Obselete - use ZoomFactor instead.