Java 类com.badlogic.gdx.input.GestureDetector.GestureAdapter 实例源码

项目:gaiasky    文件:SpacecraftCamera.java   
public SpacecraftCamera(AssetManager assetManager, CameraManager parent) {
    super(parent);

    // orientation
    direction = new Vector3d(1, 0, 0);
    up = new Vector3d(0, 1, 0);
    relpos = new Vector3d();

    todesired = new Vector3d();
    desired = new Vector3d();
    aux2 = new Vector3d();
    scthrust = new Vector3d();
    scforce = new Vector3d();
    scaccel = new Vector3d();
    scvel = new Vector3d();
    scpos = new Vector3d();

    // init camera
    camera = new PerspectiveCamera(20, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.near = (float) (100d * Constants.KM_TO_U);
    camera.far = (float) CAM_FAR;

    // init cameras vector
    cameras = new PerspectiveCamera[] { camera, camLeft, camRight };

    // init gui camera
    guiCam = new PerspectiveCamera(30, 300, 300);
    guiCam.near = (float) CAM_NEAR;
    guiCam.far = (float) CAM_FAR;

    // aspect ratio
    ar = (float) Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight();

    // fov factor
    fovFactor = camera.fieldOfView / 40f;

    inputController = new SpacecraftInputController(new GestureAdapter());
    controllerListener = new SpacecraftControllerListener();

    // Init sprite batch for crosshair and cockpit
    spriteBatch = new SpriteBatch();
    crosshairTex = new Texture(Gdx.files.internal("img/crosshair-sc-yellow.png"));
    chw2 = crosshairTex.getWidth() / 2f;
    chh2 = crosshairTex.getHeight() / 2f;

    // Focus is changed from GUI
    EventManager.instance.subscribe(this, Events.FOV_CHANGED_CMD, Events.SPACECRAFT_LOADED);
}