APIdia Launch Partner
Top Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.utils

public Class CameraInputController

extends GestureDetector
Class Inheritance
Imports
com.badlogic.gdx.Gdx, .Input.Keys, .Input.Buttons, com.badlogic.gdx.graphics.Camera, com.badlogic.gdx.input.GestureDetector, com.badlogic.gdx.math.MathUtils, .Vector2, .Vector3

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
public int
activateKey

The key which must be pressed to activate rotate, translate and forward or 0 to always activate.

protected boolean
activatePressed

Indicates if the activateKey is currently being pressed.

public boolean
alwaysScroll

Whether scrolling requires the activeKey to be pressed (false) or always allow scrolling (true).

public boolean
autoUpdate

Whether to update the camera after it has been changed.

public int
protected boolean
protected int
button

The current (first) button being pressed.

public Camera
camera

The camera.

protected boolean
public int
forwardButton

The button for translating the camera along the direction axis

public int
protected boolean
public boolean
forwardTarget

Whether to update the target on forward

protected final CameraInputController.CameraGestureListener
private boolean
public float
pinchZoomFactor

World units per screen size

public float
rotateAngle

The angle to rotate when moved the full width or height of the screen.

public int
rotateButton

The button for rotating the camera.

public int
protected boolean
public int
protected boolean
public float
scrollFactor

The weight for each scrolled amount.

public boolean
scrollTarget

Whether to update the target on scroll

private float
private float
public Vector3
target

The target to rotate around.

private final Vector3
private final Vector3
private int
public int
translateButton

The button for translating the camera along the up/right plane

public boolean
translateTarget

Whether to update the target on translation

public float
translateUnits

The units to translate the camera when moved the full width or height of the screen.

Constructor Summary

AccessConstructor and Description
protected
public

Method Summary

Modifier and TypeMethod and Description
public boolean
keyDown(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyDown.

Implements com.badlogic.gdx.InputProcessor.keyDown.

Called when a key was pressed

public boolean
keyUp(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyUp.

Implements com.badlogic.gdx.InputProcessor.keyUp.

Called when a key was released

protected boolean
pinchZoom(float amount)

protected boolean
process(float deltaX, float deltaY, int button)

public boolean
scrolled(float amountX, float amountY)

Overrides com.badlogic.gdx.InputAdapter.scrolled.

Implements com.badlogic.gdx.InputProcessor.scrolled.

Called when the mouse wheel was scrolled.

public void
setInvertedControls(boolean
Whether or not to invert the controls
invertControls
)

Sets the CameraInputControllers' control inversion.

public boolean
touchDown(int screenX, int screenY, int pointer, int button)

Overrides com.badlogic.gdx.input.GestureDetector.touchDown.

Implements com.badlogic.gdx.InputProcessor.touchDown.

Called when the screen was touched or a mouse button was pressed.

public boolean
touchDragged(int screenX, int screenY, int pointer)

Overrides com.badlogic.gdx.input.GestureDetector.touchDragged.

Implements com.badlogic.gdx.InputProcessor.touchDragged.

Called when a finger or the mouse was dragged.

public boolean
touchUp(int screenX, int screenY, int pointer, int button)

Overrides com.badlogic.gdx.input.GestureDetector.touchUp.

Implements com.badlogic.gdx.InputProcessor.touchUp.

Called when a finger was lifted or a mouse button was released.

public void
public boolean
zoom(float amount)

Inherited from com.badlogic.gdx.input.GestureDetector:
cancelinvalidateTapSquareisLongPressedisLongPressedisPanningresetsetLongPressSecondssetMaxFlingDelaysetTapCountIntervalsetTapRectangleSizesetTapSquareSizetouchCancelledtouchDowntouchDraggedtouchUp

Field Detail

activateKeyback to summary
public int activateKey

The key which must be pressed to activate rotate, translate and forward or 0 to always activate.

activatePressedback to summary
protected boolean activatePressed

Indicates if the activateKey is currently being pressed.

alwaysScrollback to summary
public boolean alwaysScroll

Whether scrolling requires the activeKey to be pressed (false) or always allow scrolling (true).

autoUpdateback to summary
public boolean autoUpdate

Whether to update the camera after it has been changed.

backwardKeyback to summary
public int backwardKey
backwardPressedback to summary
protected boolean backwardPressed
buttonback to summary
protected int button

The current (first) button being pressed.

cameraback to summary
public Camera camera

The camera.

controlsInvertedback to summary
protected boolean controlsInverted
forwardButtonback to summary
public int forwardButton

The button for translating the camera along the direction axis

forwardKeyback to summary
public int forwardKey
forwardPressedback to summary
protected boolean forwardPressed
forwardTargetback to summary
public boolean forwardTarget

Whether to update the target on forward

gestureListenerback to summary
protected final CameraInputController.CameraGestureListener gestureListener
multiTouchback to summary
private boolean multiTouch
pinchZoomFactorback to summary
public float pinchZoomFactor

World units per screen size

rotateAngleback to summary
public float rotateAngle

The angle to rotate when moved the full width or height of the screen.

rotateButtonback to summary
public int rotateButton

The button for rotating the camera.

rotateLeftKeyback to summary
public int rotateLeftKey
rotateLeftPressedback to summary
protected boolean rotateLeftPressed
rotateRightKeyback to summary
public int rotateRightKey
rotateRightPressedback to summary
protected boolean rotateRightPressed
scrollFactorback to summary
public float scrollFactor

The weight for each scrolled amount.

scrollTargetback to summary
public boolean scrollTarget

Whether to update the target on scroll

startXback to summary
private float startX
startYback to summary
private float startY
targetback to summary
public Vector3 target

The target to rotate around.

tmpV1back to summary
private final Vector3 tmpV1
tmpV2back to summary
private final Vector3 tmpV2
touchedback to summary
private int touched
translateButtonback to summary
public int translateButton

The button for translating the camera along the up/right plane

translateTargetback to summary
public boolean translateTarget

Whether to update the target on translation

translateUnitsback to summary
public float translateUnits

The units to translate the camera when moved the full width or height of the screen.

Constructor Detail

CameraInputControllerback to summary
protected CameraInputController(final CameraInputController.CameraGestureListener gestureListener, final Camera camera)
CameraInputControllerback to summary
public CameraInputController(final Camera camera)

Method Detail

keyDownback to summary
public boolean keyDown(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyDown.

Implements com.badlogic.gdx.InputProcessor.keyDown.

Doc from com.badlogic.gdx.InputProcessor.keyDown.

Called when a key was pressed

Annotations
@Override
keyUpback to summary
public boolean keyUp(int keycode)

Overrides com.badlogic.gdx.InputAdapter.keyUp.

Implements com.badlogic.gdx.InputProcessor.keyUp.

Doc from com.badlogic.gdx.InputProcessor.keyUp.

Called when a key was released

Annotations
@Override
pinchZoomback to summary
protected boolean pinchZoom(float amount)
processback to summary
protected boolean process(float deltaX, float deltaY, int button)
scrolledback to summary
public boolean scrolled(float amountX, float amountY)

Overrides com.badlogic.gdx.InputAdapter.scrolled.

Implements com.badlogic.gdx.InputProcessor.scrolled.

Doc from com.badlogic.gdx.InputProcessor.scrolled.

Called when the mouse wheel was scrolled. Will not be called on iOS.

Annotations
@Override
setInvertedControlsback to summary
public void setInvertedControls(boolean invertControls)

Sets the CameraInputControllers' control inversion.

Parameters
invertControls:boolean

Whether or not to invert the controls

touchDownback to summary
public boolean touchDown(int screenX, int screenY, int pointer, int button)

Overrides com.badlogic.gdx.input.GestureDetector.touchDown.

Implements com.badlogic.gdx.InputProcessor.touchDown.

Doc from com.badlogic.gdx.InputProcessor.touchDown.

Called when the screen was touched or a mouse button was pressed. The button parameter will be Buttons#LEFT on iOS.

Annotations
@Override
touchDraggedback to summary
public boolean touchDragged(int screenX, int screenY, int pointer)

Overrides com.badlogic.gdx.input.GestureDetector.touchDragged.

Implements com.badlogic.gdx.InputProcessor.touchDragged.

Doc from com.badlogic.gdx.InputProcessor.touchDragged.

Called when a finger or the mouse was dragged.

Annotations
@Override
touchUpback to summary
public boolean touchUp(int screenX, int screenY, int pointer, int button)

Overrides com.badlogic.gdx.input.GestureDetector.touchUp.

Implements com.badlogic.gdx.InputProcessor.touchUp.

Doc from com.badlogic.gdx.InputProcessor.touchUp.

Called when a finger was lifted or a mouse button was released. The button parameter will be Buttons#LEFT on iOS.

Annotations
@Override
updateback to summary
public void update()
zoomback to summary
public boolean zoom(float amount)
com.badlogic.gdx.graphics.g3d.utils back to summary

protected Class CameraInputController.CameraGestureListener

extends GestureAdapter
Class Inheritance

Field Summary

Modifier and TypeField and Description
public CameraInputController
private float

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public boolean
fling(float velocityX, float velocityY, int button)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.fling.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.fling.

Called when the user dragged a finger over the screen and lifted it.

public boolean
public boolean
pan(float x, float y, float deltaX, float deltaY)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.pan.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.pan.

Called when the user drags a finger over the screen.

public boolean
pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.pinch.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.pinch.

Called when a user performs a pinch zoom gesture.

public boolean
tap(float x, float y, int count, int button)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.tap.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.tap.

Called when a tap occured.

public boolean
public boolean
zoom(float initialDistance, float distance)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.zoom.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.zoom.

Called when the user performs a pinch zoom gesture.

Inherited from com.badlogic.gdx.input.GestureDetector.GestureAdapter:
panStoppinchStop

Field Detail

controllerback to summary
public CameraInputController controller
previousZoomback to summary
private float previousZoom

Constructor Detail

CameraGestureListenerback to summary
protected CameraGestureListener()

Method Detail

flingback to summary
public boolean fling(float velocityX, float velocityY, int button)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.fling.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.fling.

Doc from com.badlogic.gdx.input.GestureDetector.GestureListener.fling.

Called when the user dragged a finger over the screen and lifted it. Reports the last known velocity of the finger in pixels per second.

Annotations
@Override
longPressback to summary
public boolean longPress(float x, float y)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.longPress.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.longPress.

Annotations
@Override
panback to summary
public boolean pan(float x, float y, float deltaX, float deltaY)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.pan.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.pan.

Doc from com.badlogic.gdx.input.GestureDetector.GestureListener.pan.

Called when the user drags a finger over the screen.

Annotations
@Override
pinchback to summary
public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.pinch.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.pinch.

Doc from com.badlogic.gdx.input.GestureDetector.GestureListener.pinch.

Called when a user performs a pinch zoom gesture. Reports the initial positions of the two involved fingers and their current positions.

Annotations
@Override
tapback to summary
public boolean tap(float x, float y, int count, int button)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.tap.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.tap.

Doc from com.badlogic.gdx.input.GestureDetector.GestureListener.tap.

Called when a tap occured. A tap happens if a touch went down on the screen and was lifted again without moving outside of the tap square. The tap square is a rectangular area around the initial touch position as specified on construction time of the GestureDetector.

Annotations
@Override
touchDownback to summary
public boolean touchDown(float x, float y, int pointer, int button)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.touchDown.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.touchDown.

Annotations
@Override
zoomback to summary
public boolean zoom(float initialDistance, float distance)

Overrides com.badlogic.gdx.input.GestureDetector.GestureAdapter.zoom.

Implements com.badlogic.gdx.input.GestureDetector.GestureListener.zoom.

Doc from com.badlogic.gdx.input.GestureDetector.GestureListener.zoom.

Called when the user performs a pinch zoom gesture. The original distance is the distance in pixels when the gesture started.

Annotations
@Override