APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.graphics

public Class OrthographicCamera

extends Camera
Class Inheritance
Imports
com.badlogic.gdx.Gdx, com.badlogic.gdx.math.Matrix4, .Vector2, .Vector3

A camera with orthographic projection.
Author
mzechner

Field Summary

Modifier and TypeField and Description
private final Vector3
public float
zoom

the zoom of the camera

Inherited from com.badlogic.gdx.graphics.Camera:
combineddirectionfarfrustuminvProjectionViewnearpositionprojectionupviewviewportHeightviewportWidth

Constructor Summary

AccessConstructor and Description
public
public
OrthographicCamera(float
the viewport width
viewportWidth
,
float
the viewport height
viewportHeight
)

Constructs a new OrthographicCamera, using the given viewport width and height.

Method Summary

Modifier and TypeMethod and Description
public void
rotate(float angle)

Rotates the camera by the given angle around the direction vector.

public void
setToOrtho(boolean
whether y should be pointing down
yDown
)

Sets this camera to an orthographic projection using a viewport fitting the screen resolution, centered at (Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2), with the y-axis pointing up or down.

public void
setToOrtho(boolean
whether y should be pointing down.
yDown
,
float viewportWidth, float viewportHeight)

Sets this camera to an orthographic projection, centered at (viewportWidth/2, viewportHeight/2), with the y-axis pointing up or down.

public void
translate(float
the displacement on the x-axis
x
,
float
the displacement on the y-axis
y
)

Moves the camera by the given amount on each axis.

public void
translate(Vector2
the displacement vector
vec
)

Moves the camera by the given vector.

public void
update()

Implements abstract com.badlogic.gdx.graphics.Camera.update.

Recalculates the projection and view matrix of this camera and the Frustum planes.

public void
update(boolean updateFrustum)

Implements abstract com.badlogic.gdx.graphics.Camera.update.

Recalculates the projection and view matrix of this camera and the Frustum planes if updateFrustum is true.

Inherited from com.badlogic.gdx.graphics.Camera:
getPickRaygetPickRaylookAtlookAtnormalizeUpprojectprojectrotaterotaterotaterotaterotateAroundtransformtranslatetranslateunprojectunproject

Field Detail

tmpback to summary
private final Vector3 tmp
zoomback to summary
public float zoom

the zoom of the camera

Constructor Detail

OrthographicCameraback to summary
public OrthographicCamera()
OrthographicCameraback to summary
public OrthographicCamera(float viewportWidth, float viewportHeight)

Constructs a new OrthographicCamera, using the given viewport width and height. For pixel perfect 2D rendering just supply the screen size, for other unit scales (e.g. meters for box2d) proceed accordingly. The camera will show the region [-viewportWidth/2, -(viewportHeight/2-1)] - [(viewportWidth/2-1), viewportHeight/2]

Parameters
viewportWidth:float

the viewport width

viewportHeight:float

the viewport height

Method Detail

rotateback to summary
public void rotate(float angle)

Rotates the camera by the given angle around the direction vector. The direction and up vector will not be orthogonalized.

setToOrthoback to summary
public void setToOrtho(boolean yDown)

Sets this camera to an orthographic projection using a viewport fitting the screen resolution, centered at (Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2), with the y-axis pointing up or down.

Parameters
yDown:boolean

whether y should be pointing down

setToOrthoback to summary
public void setToOrtho(boolean yDown, float viewportWidth, float viewportHeight)

Sets this camera to an orthographic projection, centered at (viewportWidth/2, viewportHeight/2), with the y-axis pointing up or down.

Parameters
yDown:boolean

whether y should be pointing down.

translateback to summary
public void translate(float x, float y)

Moves the camera by the given amount on each axis.

Parameters
x:float

the displacement on the x-axis

y:float

the displacement on the y-axis

translateback to summary
public void translate(Vector2 vec)

Moves the camera by the given vector.

Parameters
vec:Vector2

the displacement vector

updateback to summary
public void update()

Implements abstract com.badlogic.gdx.graphics.Camera.update.

Doc from com.badlogic.gdx.graphics.Camera.update.

Recalculates the projection and view matrix of this camera and the Frustum planes. Use this after you've manipulated any of the attributes of the camera.

Annotations
@Override
updateback to summary
public void update(boolean updateFrustum)

Implements abstract com.badlogic.gdx.graphics.Camera.update.

Doc from com.badlogic.gdx.graphics.Camera.update.

Recalculates the projection and view matrix of this camera and the Frustum planes if updateFrustum is true. Use this after you've manipulated any of the attributes of the camera.

Annotations
@Override