Example usage for com.badlogic.gdx.utils.viewport Viewport unproject

List of usage examples for com.badlogic.gdx.utils.viewport Viewport unproject

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils.viewport Viewport unproject.

Prototype

public Vector3 unproject(Vector3 screenCoords) 

Source Link

Document

Transforms the specified screen coordinate to world coordinates.

Usage

From source file:com.bladecoder.engine.ui.defaults.ScenePointer.java

License:Apache License

private void getInputUnproject(Viewport v, Vector2 out) {
    out.set(Gdx.input.getX(), Gdx.input.getY());

    v.unproject(out);
}

From source file:org.bladecoder.bladeengine.ui.Pointer.java

License:Apache License

private void getInputUnproject(Viewport v, Vector2 out) {
    out.set(Gdx.input.getX(), Gdx.input.getY());

    v.unproject(out);

    //      if (out.x >= v.getWorldWidth())
    //         out.x = v.getWorldWidth() - 1;
    //      else if (out.x < 0)
    //         out.x = 0;
    ///* w  w  w . j  ava2  s .c o  m*/
    //      if (out.y >= v.getWorldHeight())
    //         out.y = v.getWorldHeight() - 1;
    //      else if (out.y < 0)
    //         out.y = 0;
}