Example usage for com.badlogic.gdx.math Vector2 add

List of usage examples for com.badlogic.gdx.math Vector2 add

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Vector2 add.

Prototype

public Vector2 add(float x, float y) 

Source Link

Document

Adds the given components to this vector

Usage

From source file:org.saltosion.pixelprophecy.input.GameInputAdapter.java

License:Open Source License

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Vector2 screenSize = new Vector2(Globals.VIEWPORT_HEIGHT * Globals.ASPECT_RATIO, Globals.VIEWPORT_HEIGHT);
    Vector2 pos = new Vector2(screenX * screenSize.x / Gdx.graphics.getWidth(),
            (Gdx.graphics.getHeight() - screenY) * screenSize.y / Gdx.graphics.getHeight());
    OrthographicCamera cam = gameState.getGameCamera();
    pos.add(cam.position.x, cam.position.y);
    pos.sub(screenSize.scl(.5f));// w  w  w. j a v  a2s  .  c  o  m
    System.out.println(pos);
    return true;
}