libgdx API

com.badlogic.gdx.graphics
Class OrthographicCamera

java.lang.Object
  extended by com.badlogic.gdx.graphics.Camera
      extended by com.badlogic.gdx.graphics.OrthographicCamera

public class OrthographicCamera
extends Camera

A camera with orthographic projection.

Author:
mzechner

Field Summary
 float zoom
          the zoom of the camera
 
Fields inherited from class com.badlogic.gdx.graphics.Camera
combined, direction, far, frustum, invProjectionView, near, position, projection, up, view, viewportHeight, viewportWidth
 
Constructor Summary
OrthographicCamera()
           
OrthographicCamera(float viewportWidth, float viewportHeight)
          Constructs a new OrthographicCamera, using the given viewport width and height.
OrthographicCamera(float viewportWidth, float viewportHeight, float diamondAngle)
          Constructs a new OrthographicCamera, using the given viewport width and height.
 
Method Summary
 void findDirectionForIsoView(float targetAngle, float epsilon, int maxIterations)
           
 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.
 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.
 void update()
          Recalculates the projection and view matrix of this camera and the Frustum planes.
 
Methods inherited from class com.badlogic.gdx.graphics.Camera
apply, getPickRay, getPickRay, lookAt, normalizeUp, project, project, rotate, translate, unproject, unproject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

zoom

public float zoom
the zoom of the camera

Constructor Detail

OrthographicCamera

public OrthographicCamera()

OrthographicCamera

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.

Parameters:
viewportWidth - the viewport width
viewportHeight - the viewport height

OrthographicCamera

public OrthographicCamera(float viewportWidth,
                          float viewportHeight,
                          float diamondAngle)
Constructs a new OrthographicCamera, using the given viewport width and height. This will create a camera useable for iso-metric views. The diamond angle is specifies the angle of a tile viewed isometrically.

Parameters:
viewportWidth - the viewport width
viewportHeight - the viewport height
diamondAngle - the angle in degrees
Method Detail

findDirectionForIsoView

public void findDirectionForIsoView(float targetAngle,
                                    float epsilon,
                                    int maxIterations)

update

public void update()
Description copied from class: Camera
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.

Specified by:
update in class Camera

setToOrtho

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 - whether y should be pointing down

setToOrtho

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 - whether y should be pointing down.
viewportWidth -
viewportHeight -

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)